~skiqqy/bin

ref: 2ffbd75ac95a0d869b3394ea2e4214ec321bacea bin/copy -rwxr-xr-x 592 bytes
2ffbd75aStephen Cochrane init of copy 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Simple xclip X dmenu script
scriptname="$(basename "$0")"

usage()
{
	cat << EOF
$scriptname ~ Simple copy buffer
EOF
	exit "${1:-0}"
}

main()
{
	buffer='/tmp/copy.buffer'

	while getopts hb: opt
	do
		case "$opt" in
			b)
				buffer="$OPTARG"
				[ ! -f "$buffer" ] && printf 'WARN: %s DNE!\n' "$buffer" && return 1
				;;
			h)
				usage
				;;
			*)
				usage 1
				;;
		esac
	done
	shift "$((OPTIND-1))"

	# TODO.

	local com
	com="$1"
	shift 1

	case "$com" in
		'')
			usage
			;;
		*)
			printf 'Unknown Command: %s\n' "$com"
			usage 1
			;;
	esac
}

main "$@"