-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·62 lines (55 loc) · 1.05 KB
/
update.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
62
#!/bin/bash
# Synchronize files in repository with files in pentadactyl directory.
PENTADIR="$HOME/.pentadactyl"
COLORSDIR="$PENTADIR/colors"
OIFS=$IFS
IFS=","
COLORS=("simple.penta,simple_dark.penta")
Usage(){
echo "Usage: $(basename $0) OPTION
Options:
-n [--no-op]
Echo actions to be performed. Do not perform them.
-v [--verbose]
Echo actions and perform them.
-s [--silent] (Default action, when no flags provided)
Only perform actions, do not echo them.
-h [--help]
Print this message."
}
update_colors(){
case $1 in
"noop" )
for color in ${COLORS[@]} ; do
echo "cp $color $COLORSDIR"
done
;;
"verbose" )
for color in ${COLORS[@]} ; do
cp $color $COLORSDIR
echo "cp $color $COLORSDIR ... DONE"
done
;;
"silent" )
for color in ${COLORS[@]} ; do
cp $color $COLORSDIR
done
;;
esac
}
case $1 in
"-n" | "--no-op" )
update_colors noop
;;
"-v" | "--verbose" )
update_colors verbose
;;
"-h" | "--help" )
Usage
;;
"-s" | "--silent" | * )
update_colors silent
;;
esac
IFS=$OIFS
# vim:noet