29 lines
596 B
Bash
29 lines
596 B
Bash
#!/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"
|
|
}
|