new help examples
This commit is contained in:
28
helpers/help.sh
Normal file
28
helpers/help.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
#TODO source basic.sh
|
||||
#TODO source args-parser/args.sh
|
||||
|
||||
########################################################
|
||||
# Help functions
|
||||
########################################################
|
||||
|
||||
process_help_arg() {
|
||||
command="${FUNCNAME[1]}"
|
||||
need_help=$(arg help 1)
|
||||
[[ "$need_help" -eq 0 ]] && need_help=$(argl help 1)
|
||||
[[ "$need_help" -eq 1 ]] && help "$command"
|
||||
}
|
||||
|
||||
help() {
|
||||
is_function "help.$1" && help."$1" && exit
|
||||
echo "Main help message"
|
||||
}
|
||||
|
||||
help.example() {
|
||||
echo "Example help message"
|
||||
}
|
||||
|
||||
example() {
|
||||
process_help_arg
|
||||
echo "Example command"
|
||||
}
|
||||
Reference in New Issue
Block a user