-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathCHECKLIST.txt
78 lines (40 loc) · 1.52 KB
/
CHECKLIST.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
script optimization checklist
-----------------------------
* passes http://www.shellcheck.net/#
* stub
* correct and up to date information
* confirm supported platform (as much as possible)
* good description
* usage
* function declaration style: usage() {
* test $# = 0 || echo "$@"
* usage line style: echo "Usage: $0 [OPTION]... FILENAME"
* good brief usage message on the 3rd line (of the output)
* list of options
* comprehensive
* good explanation
* help option -h, --help
* exit 1 at the end
* command line parser
* negate with --no-FLAG
* do not provide --no-FLAG if not useful
* sample lines (optional if there are real examples)
* flag
* param
* no unnecessary "--" parsing (comment out)
* = shift; while test "$1"; do args+=("$1"); shift; done; break ;;
* do not parse *) unnecessarily (comment out)
* pre-main
* default values
* flag checks: on | off
* comment out or remove set -- "${args[@]}" if not needed
* zero argument check: test $# = 0 && usage "possibly a message"
* main
* proper handling of filenames with spaces
* proper handling of missing external commands (see for example in wav2mp3.sh)
* proper handling of missing perl modules
* clean up using trap: trap 'cleanup; exit 1' 1 2 3 15
* watch out for differences in command flags across different OS-es
* use date +%F instead of date --iso
* use $() instead of ``
* exit codes: make sure it's non-zero on any non-normal exit