new help examples

This commit is contained in:
2025-02-08 13:24:30 +08:00
parent 66126167c8
commit 526dade1f8

28
helpers/help.sh Normal file
View 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"
}