From 3ca95b33f2dc650b384a96dc1d3aa3d8d18553d1 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 1 Mar 2024 19:30:33 +0200 Subject: Changes help subcommand to flag style -h, --help --- bin/ak-categories | 26 ++++++++++++-------------- bin/ak-comments | 17 ++++++++--------- bin/ak-folders | 2 +- bin/ak-logthis | 14 +++++++++++--- bin/ak-news | 2 +- bin/ak-reference | 4 ++-- bin/ak-repositories | 18 +++++++++--------- bin/ak-roadmap | 10 +++++----- bin/ak-sm-files | 6 +++--- bin/ak-todos | 35 +++++++++++++++++------------------ 10 files changed, 69 insertions(+), 65 deletions(-) diff --git a/bin/ak-categories b/bin/ak-categories index 32edb4f..e50e1fc 100755 --- a/bin/ak-categories +++ b/bin/ak-categories @@ -97,23 +97,21 @@ EOF fi } _ak_modules_categories_usage(){ - echo "#TODO" - echo "All you need to know is that there are two options available:" - echo "help Prints this help message" - echo "index Prints an indexed table of your news files" - echo "import #TODO" - echo "add Creates a data file from the news file you point to" - echo "create Vim is going to pop up, you will write and save your" - echo " newsletter and it's going to be saved" - exit 0 + echo " -h, --help Prints this help message" + echo " index Prints an indexed table of your news files" + echo " import #TODO" + echo " add Creates a data file from the news file you point to" + echo " create Vim is going to pop up, you will write and save your" + echo " newsletter and it's going to be saved" + exit 0 } _ak_modules_categories_title if [ ! -z $1 ]; then - case $1 in - help) _ak_modules_categories_usage; exit;; - index) _ak_modules_categories_index; exit;; - import) _ak_modules_categories_import $2; exit;; - add) _ak_modules_categories_add $2; exit;; + case $1 in + -h | --help) _ak_modules_categories_usage; exit;; + index) _ak_modules_categories_index; exit;; + import) _ak_modules_categories_import $2; exit;; + add) _ak_modules_categories_add $2; exit;; create) _ak_modules_categories_create; exit;; * ) _ak_modules_categories_usage;; esac diff --git a/bin/ak-comments b/bin/ak-comments index d4a73de..3543d99 100755 --- a/bin/ak-comments +++ b/bin/ak-comments @@ -79,15 +79,14 @@ _ak_modules_comments_add(){ fi } _ak_modules_comments_usage(){ - _ak_modules_comments_title - echo "All you need to know is that there are two options available:" - echo "" - echo "help Prints this help message" - echo "index Prints an indexed table of your comments files" - echo "add Creates a data file from the comments file you point to" - echo "create Vim is going to pop up, you will write and save your" - echo " commentsletter and it's going to be saved" - exit 0 + _ak_modules_comments_title + echo "" + echo "-h, --help Prints this help message" + echo "index Prints an indexed table of your comments files" + echo "add Creates a data file from the comments file you point to" + echo "create Vim is going to pop up, you will write and save your" + echo " commentsletter and it's going to be saved" + exit 0 } if [ ! -z $1 ]; then diff --git a/bin/ak-folders b/bin/ak-folders index 280af2b..33d9c2f 100755 --- a/bin/ak-folders +++ b/bin/ak-folders @@ -78,7 +78,7 @@ _ak_modules_folders_title(){ if [ ! -z $1 ]; then case $1 in - help) _ak_modules_folders_usage; exit;; + -h | --help) _ak_modules_folders_usage; exit;; add) _ak_modules_folders_add $2; exit;; *) _ak_modules_folders_usage; exit;; esac diff --git a/bin/ak-logthis b/bin/ak-logthis index 2ac3d80..b225313 100755 --- a/bin/ak-logthis +++ b/bin/ak-logthis @@ -1,10 +1,18 @@ #!/bin/bash +PROGRAM="$(basename $0)" TS="$(date -u +%s)" -if [ ! -z "$1" ] +if [ ! -z $1 ] && [ -n "$1" ] then - if [ ! -z "$2" ] + if [ "$1" == "-h" ] || [ "$1" == "--help" ] then - if [ ! -z "$3" ] + echo "$PROGRAM - Log events" + echo "-h, --help Prints this message" + echo " Logs this message" + exit 0 + fi + if [ ! -z "$2" ] && [ -n "$2" ] + then + if [ ! -z "$3" ] && [ -n "$3" ] then echo "$TS" "<$1>" "[$2]" "$3" >> $AK_LOGSFILE if [ "$AK_DEBUG" == "yes" ] diff --git a/bin/ak-news b/bin/ak-news index 9824788..67fd5aa 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -196,7 +196,7 @@ _ak_modules_news_read(){ _ak_modules_news_title if [ ! -z $1 ]; then case $1 in - help) _ak_modules_news_usage; exit;; + -h | --help) _ak_modules_news_usage; exit;; local-index) _ak_modules_news_index; exit;; import) _ak_modules_news_import $2; exit;; add) _ak_modules_news_add2 $2; exit;; diff --git a/bin/ak-reference b/bin/ak-reference index 4c70b11..5b58113 100755 --- a/bin/ak-reference +++ b/bin/ak-reference @@ -112,7 +112,7 @@ _ak_modules_reference_usage(){ _ak_modules_reference_title echo "#TODO" echo "All you need to know is that there are two options available:" - echo "help Prints this help message" + echo "-h, --help Prints this help message" echo "index Prints an indexed table of your references files" echo "import #TODO" echo "add Creates a data file from the references file you point to" @@ -123,7 +123,7 @@ _ak_modules_reference_usage(){ if [ ! -z $1 ]; then case $1 in - help) _ak_modules_reference_usage; exit;; + -h | --help) _ak_modules_reference_usage; exit;; index) _ak_modules_reference_index; exit;; import) _ak_modules_reference_import $2; exit;; add) _ak_modules_reference_add $2; exit;; diff --git a/bin/ak-repositories b/bin/ak-repositories index 7689e08..1429341 100755 --- a/bin/ak-repositories +++ b/bin/ak-repositories @@ -143,21 +143,21 @@ publish(){ } usage(){ - echo "TODO" + echo "-h, --help" echo "index | add | publish | update" exit } if [ ! -z $1 ] then - case $1 in - help) usage; exit;; - index) index; exit;; - add) add "$2"; exit;; - publish) publish "$2"; exit;; - update) update "$2"; exit;; - *) echo "No command $1";usage; exit;; - esac + case $1 in + -h | --help) usage; exit;; + index) index; exit;; + add) add "$2"; exit;; + publish) publish "$2"; exit;; + update) update "$2"; exit;; + *) echo "No command $1";usage; exit;; + esac else usage fi diff --git a/bin/ak-roadmap b/bin/ak-roadmap index 1bd6202..ce0dc29 100755 --- a/bin/ak-roadmap +++ b/bin/ak-roadmap @@ -21,11 +21,11 @@ search(){ if [ ! -z $1 ]; then - case $1 in - help) usage; exit;; - search) search; exit;; - *) usage; exit;; - esac + case $1 in + -h | --help) usage; exit;; + search) search; exit;; + *) usage; exit;; + esac else usage exit 0 diff --git a/bin/ak-sm-files b/bin/ak-sm-files index 4265617..14a3a05 100755 --- a/bin/ak-sm-files +++ b/bin/ak-sm-files @@ -145,9 +145,9 @@ full-index(){ } if [ ! -z $1 ]; then - case $1 in - help) usage; exit;; - add) add $2; exit;; + case $1 in + -h | --help) usage; exit;; + add) add $2; exit;; index) index; exit;; full-index) full-index; exit;; ls-map-files) ls-mapfiles; exit;; diff --git a/bin/ak-todos b/bin/ak-todos index 4a0a8ea..741a2f9 100755 --- a/bin/ak-todos +++ b/bin/ak-todos @@ -109,25 +109,24 @@ EOF fi } _ak_modules_todos_usage(){ - _ak_modules_todos_title - echo "#TODO" - echo "All you need to know is that there are two options available:" - echo "help Prints this help message" - echo "index Prints an indexed table of your todos files" - echo "import #TODO" - echo "add Creates a data file from the todos file you point to" - echo "create Vim is going to pop up, you will write and save your" - echo " todosletter and it's going to be saved" - exit 0 + _ak_modules_todos_title + echo "" + echo "-h, --help Prints this help message" + echo "index Prints an indexed table of your todos files" + echo "import #TODO" + echo "add Creates a data file from the todos file you point to" + echo "create Vim is going to pop up, you will write and save your" + echo " todosletter and it's going to be saved" + exit 0 } if [ ! -z $1 ]; then - case $1 in - help) _ak_modules_todos_usage; exit;; - index) _ak_modules_todos_index; exit;; - import) _ak_modules_todos_import $2; exit;; - add) _ak_modules_todos_add $2; exit;; - create) _ak_modules_todos_create; exit;; - * ) _ak_modules_todos_usage;; - esac + case $1 in + -h | --help) _ak_modules_todos_usage; exit;; + index) _ak_modules_todos_index; exit;; + import) _ak_modules_todos_import $2; exit;; + add) _ak_modules_todos_add $2; exit;; + create) _ak_modules_todos_create; exit;; + * ) _ak_modules_todos_usage;; + esac else _ak_modules_todos_usage fi -- cgit v1.2.3