-
Notifications
You must be signed in to change notification settings - Fork 5
/
gsman_list.sh
executable file
·68 lines (56 loc) · 1.4 KB
/
gsman_list.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
63
64
65
66
67
68
#!/bin/bash
## /*
# @description
# This file is intended to list all of the keywords which have gsman comments
# associated with them, and will display using "gsman <keyword>".
# description@
#
# @notes
# - This file is not intended to be used by itself.
# notes@
#
# @dependencies
# functions/0300.menu.sh
# dependencies@
#
# @file gsman_list.sh
## */
$loadfuncs
flag="gs"
if [ -n "$1" ]; then
[ "$1" = "all" ] && flag="all"
[ "$1" = "user" ] && flag="user"
fi
tmp="${gitscripts_temp_path}cmdlist"
declare -a indexes
case $flag in
gs)
cat "${gitscripts_doc_path}gsman_index.txt" > "$tmp";;
user)
if [ -s "${gitscripts_doc_path}user/gsman_index.txt" ]; then
cat "${gitscripts_doc_path}user/gsman_index.txt" > "$tmp"
else
echo ${E}" No user index file could be found! Aborting... "${X}
fi;;
all)
cat "${gitscripts_doc_path}gsman_index.txt" "${gitscripts_doc_path}user/gsman_index.txt" | sort -r > "$tmp";;
esac
# build command array that will get sent to the __menu function
declare -a cmds
while read line; do
cmds[${#cmds[@]}]=${line%%:*}
done <"$tmp"
# clean up temp file
rm "$tmp"
if __menu --prompt="Choose a command to view it's documentation" "${cmds[@]}"; then
if [ -n "$_menu_sel_value" ]; then
echo
"${gitscripts_path}gsman.sh" "$_menu_sel_value"
else
echo
echo " Until next time..."
fi
else
echo ${E}" There was an error displaying the gsman commands. Exiting... "${X}
fi
exit