-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib-usage.sh
More file actions
43 lines (39 loc) · 727 Bytes
/
lib-usage.sh
File metadata and controls
43 lines (39 loc) · 727 Bytes
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
#!/usr/bin/false
LIB_USAGE_STATUS='loading'
function show-usage() {
local RC=0
local AND=''
local ONE_OF=''
local BLOCK=''
if [[ ".$1" = '.--rc' ]]
then
RC="$2"
shift 2
fi
(
echo "Usage: $(basename "$0") $1" >&2
shift
for LINE in "$@"
do
echo "${LINE}" >&2
done
if [[ "$#" -gt 0 ]]
then
AND='and '
fi
if [[ "${#VERBOSE_OPTIONS[@]}" -gt 1 ]]
then
ONE_OF=' one of'
fi
if [[ "${#VERBOSE_OPTIONS[@]}" -gt 0 ]]
then
echo "${AND}where <verbose-option> is${ONE_OF}:"
for VERBOSE_OPTION in "${VERBOSE_OPTIONS[@]}"
do
echo "${VERBOSE_OPTION}"
done
fi
) >&2
exit "${RC}"
}
LIB_USAGE_STATUS='loaded'