#!/bin/bash --norc


if [ $# -lt 1 -o $# -gt 2 ]; then
	echo "klip: Usage: $0 paste|get / copy|put  [ <string> ]" >&2
	exit 1
fi


case "$1" in

paste | get)
	dcop klipper klipper getClipboardContents
	;;

copy | put)
	if [ $# -eq 1 -o "$2" = "-" ]; then
		dcop klipper klipper setClipboardContents "$(cat)"
	else
		dcop klipper klipper setClipboardContents "$2"
	fi

esac
