aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/bin/help.sh
diff options
context:
space:
mode:
authorM.Gergo2018-07-06 11:14:41 +0200
committerM.Gergo2018-07-06 11:14:41 +0200
commit43de9af71f7f4ca5731b94a06d688ae8412ba427 (patch)
tree54835de1dfcda504c02da261f0dc26885aed2e89 /mayor-orig/bin/help.sh
parent50310b0e4513ee3fcce67351ae61e8fff851130e (diff)
downloadmayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.tar.gz
mayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.zip
2018/Feb/28 -i állapot hozzáadva, mint a módosítások kiindulási állapota
Diffstat (limited to 'mayor-orig/bin/help.sh')
-rw-r--r--mayor-orig/bin/help.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/mayor-orig/bin/help.sh b/mayor-orig/bin/help.sh
new file mode 100644
index 00000000..e983ccd3
--- /dev/null
+++ b/mayor-orig/bin/help.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+OPT_SPEC="hf::"
+LONG_OPT_SPEC="help,file:,f::"
+PARSED_OPTIONS=$(getopt -n "$0" -a -o $OPT_SPEC --long $LONG_OPT_SPEC -- "$@")
+OPTIONS_RET=$?
+eval set -- "$PARSED_OPTIONS"
+
+help_usage() {
+ print_help;
+ echo -e "\nHELP használata: mayor help [parancs]\n\n"
+}
+
+if [ $OPTIONS_RET -ne 0 ] || [ $# -le 1 ]; then help_usage; exit; fi
+
+while [ $# -ge 1 ]; do
+ case $1 in
+ --help | -h ) help_usage
+ exit
+ ;;
+
+ --file | -f ) shift
+ FILE="$1"
+ echo "FILE: $FILE"
+ ;;
+
+ -- ) shift
+ break
+ ;;
+
+ * ) echo "HIBA: ismeretlen opció: $1" # ide elvileg sose jutunk, mert a getopts már kiszűrte a hibás paramétereket...
+ exit
+ ;;
+ esac
+ shift
+done
+
+while [ $# -ge 1 ]; do
+ echo -e "\n---------- HELP: $1 ----------\n"
+ if [[ ! "${CMDS[*]}" =~ .*$1.* ]]; then
+ echo -e "Ismeretlen parancs: $1"
+ #print_help
+ else
+ . ./$1.sh --help
+ fi
+ shift
+done