version: 0.3 // cmd_tree*() help functions patch

Squashed commit of the following:

commit 21a8e24a983eeefd18ba0453e29e7961ac326585
Author: Umgeher Torgersen <me@umgeher.org>
Date:   Wed May 3 16:30:33 2023 +0000

    version: 0.3

commit f8496531bbe7f9970a16c334cf15f9a9569b46d9
Author: Umgeher Torgersen <me@umgeher.org>
Date:   Wed May 3 16:25:21 2023 +0000

    some missing information (README file) and 'echo ""' removed

commit 58062dc31da69f8476b1116b46d689b2c9d79375
Author: Theron Georgopoulos <theron@starone.one>
Date:   Wed May 3 12:41:25 2023 -0300

    Added cmd_tree*() help functions

    README and cmd_tree_help*() functions created. Please look over my
    writing and tell me what you think.

    I followed the example and left the "heavy duty explanations" to the
    README file
This commit is contained in:
Umgeher Torgersen 2023-05-03 16:31:12 +00:00
parent 4e4cc31c13
commit c19c75eb34

169
gseeker
View file

@ -2,7 +2,7 @@
### DEFINE
VERSION="0.2"
VERSION="0.3"
GSEEKER_HOME="$HOME/.gseeker"
GSEEKER_REPORTS="$GSEEKER_HOME/reports"
GSEEKER_TMPDIR="$GSEEKER_HOME/tmp/pid_$$"
@ -27,6 +27,9 @@ cmd_tree() {
show )
cmd_tree_show $*
;;
help )
cmd_tree_help $*
;;
* )
echo "usage: $0 <command> [<args>]"
echo ""
@ -34,12 +37,163 @@ cmd_tree() {
echo ""
echo " config add and delete settings"
echo " show show metadata"
echo " run run diagnostics on chosen URL's or groups added through <config>"
echo ""
echo "See '$0 help <command>' to read about a specific subcommand."
;;
esac
}
cmd_tree_help() {
case $2 in
config )
cmd_tree_help_config $*
;;
show )
cmd_tree_help_show $*
;;
run )
cmd_tree_help_run $*
;;
* )
echo "usage: $0 help <args>"
echo ""
echo " config show help for the config command"
echo " show show help for the show command"
echo " run show help for the run command"
echo ""
;;
esac
}
cmd_tree_help_config() {
case $3 in
group )
cmd_tree_help_config_group $*
;;
url )
cmd_tree_help_config_url $*
;;
* )
echo "usage: $0 help config [group, url]"
;;
esac
}
cmd_tree_help_config_group() {
case $4 in
add )
echo "usage: $0 config group add <group>"
echo ""
echo "Examples"
echo ""
echo " $0 config group add testingGroup"
echo " $0 config group add anotherGroup"
;;
del )
echo "usage: $0 config group del <group>"
echo ""
echo "Examples:"
echo ""
echo " $0 config group del testingGroup"
echo " $0 config group del anotherGroup"
;;
* )
echo "usage: $0 help config group [add, del]"
;;
esac
}
cmd_tree_help_config_url() {
case $4 in
add )
echo "usage: $0 config url add <url> <group>"
echo ""
echo "Examples:"
echo ""
echo '$0 config url add "https://git.sr.ht/~umgeher/gseeker" gseekerGroup'
echo '$0 config url add "https://git.sr.ht/~someperson/someproject" someGroup'
;;
del )
echo "usage: $0 config url del <id> <group>"
echo ""
echo "Examples:"
echo ""
echo '$0 config url del 05e8314dd1e2552e7d124048fba8f275d4ad0f60 gseekerGroup'
echo '$0 config url del cbbb2a6efd6217a48fd16b5c9430f2876bab222a someGroup'
echo ""
echo "<id> are the sha1 hashes of the URL's"
;;
* )
echo "usage: $0 help config url [add, del]"
;;
esac
}
cmd_tree_help_show() {
case $3 in
config )
echo "prints all URL's and groups added to the config file through the"
echo '"config [group, url] add <args>" command to standard output'
echo ""
echo "Example:"
echo ""
echo "$0 show config"
;;
* )
echo "usage: $0 help show config"
;;
esac
}
cmd_tree_help_run() {
case $3 in
null )
echo 'where "null" stands for no following <args>:'
echo ""
echo "runs diagnostics on all URL's found within any group in the config"
echo "file"
echo ""
echo "Example:"
echo ""
echo "$0 run"
;;
group )
cmd_tree_help_run_group $*
;;
* )
echo "usage: $0 help run [null, group]"
;;
esac
}
cmd_tree_help_run_group() {
case $4 in
null )
echo 'where "null" stands for no following <args>:'
echo ""
echo "runs diagnostics on all URL's found within the specified group in the"
echo "config file"
echo ""
echo "Example:"
echo ""
echo "$0 run gseekerGroup"
echo "$0 run someGroup"
;;
url )
echo "runs diagnostics on the specified URL found in the specified group"
echo ""
echo "Example:"
echo ""
echo '$0 run gseekerGroup "https://git.sr.ht/~umgeher/gseeker"'
echo '$0 run someGroup "https://git.sr.ht/~someperson/someproject"'
;;
* )
echo "usage: $0 help run group [null, url]"
;;
esac
}
cmd_tree_config() {
case $2 in
group )
@ -51,8 +205,8 @@ cmd_tree_config() {
* )
echo "usage: $0 config <command> [<args>]"
echo ""
echo " group "
echo " url "
echo " group add or delete a group from the config file"
echo " url add or delete a URL from the config file"
echo ""
echo "See '$0 help config <command>' to read about a specific subcommand."
;;
@ -70,8 +224,8 @@ cmd_tree_config_group() {
* )
echo "usage: $0 config group <command> [<args>]"
echo ""
echo " add "
echo " del "
echo " add add a group to the config file"
echo " del delete a group from the config file"
echo ""
echo "See '$0 help config group <command>' to read about a specific subcommand."
;;
@ -106,7 +260,8 @@ cmd_tree_config_url() {
* )
echo "usage: $0 config url <command> [<args>]"
echo ""
echo "..."
echo " add add a URL to the config file"
echo " del delete a URL from the config file"
echo ""
echo "See '$0 help config url <command>' to read about a specific subcommand."
;;
@ -161,7 +316,7 @@ cmd_tree_show() {
* )
echo "usage: $0 show <command>"
echo ""
echo " config -- show configurations"
echo "See '$0 help show <command>' to read about a specific subcommand."
;;
esac
}