-
Notifications
You must be signed in to change notification settings - Fork 0
/
clipboy.sh
61 lines (61 loc) · 1.58 KB
/
clipboy.sh
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
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
## clipboy
## - reads from clipboard and does things
## version 0.1.3 - stripdown, shift on say
##################################################
. ${SH2}/error.sh # error handling
error "true" # show errors
. ${SH2}/cecho.sh # colored echo
. ${SH2}/aliases/commands.sh # commands
generate-temp() { ${SH2}/generate-temp.sh ${@} ; }
_cleanup() {
{
cecho yellow $( rm -rvf ${temp}-* )
} 2>/dev/null
}
temp=
initialize() {
temp=$(
generate-temp
)
touch "${temp}-test"
}
clipboy-say() {
cecho green "${@}"
}
clipboy-main() {
list-available-commands clipboy- \
| sed -e 's/clipboy-//' \
| grep -v -e '\$'
}
clipboy() { { local candidate_command ; candidate_command="$( echo ${1} | cut '-d:' '-f1' )" ; }
initialize
test ! "${candidate_command}" = "say" || shift
test -d "$( dirname ${0} )/commands" || mkdir -pv "${_}"
local command_found
for command_found in $( find $( dirname ${0} )/commands -type f -name "*-clipboy-${candidate_command}*.sh" )
do
cecho green importing $( basename ${command_found} .sh ) ...
. ${command_found}
done 2>/dev/null
test ! "$( declare -f clipboy-${candidate_command} )" || {
clipboy-${candidate_command} ${@}
# history here
return
}
commands
}
##################################################
if [ ! ]
then
true
else
exit 1 # wrong args
fi
##################################################
clipboy ${@}
##################################################
## generated by create-stub2.sh v0.1.1
## on Thu, 08 Nov 2018 12:51:06 +0900
## see <https://github.com/temptemp3/sh2>
##################################################