From 526dade1f847b7b87f45e139457a0c8b7f6591c1 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sat, 8 Feb 2025 13:24:30 +0800 Subject: [PATCH] new help examples --- helpers/help.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 helpers/help.sh diff --git a/helpers/help.sh b/helpers/help.sh new file mode 100644 index 0000000..2572a23 --- /dev/null +++ b/helpers/help.sh @@ -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" +}