Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (d07aab8dcc1e2ef7b0c55c5a920a04844f1a930d)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Bor Kraljič <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (d07aab8dcc1e2ef7b0c55c5a920a04844f1a930d)
  • Date: Sun, 12 Sep 2010 08:55:04 -0500

GIT changes to master guru-tools by Bor Kraljič <pyrobor AT ver.si>:

hashcheck.sh | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit d07aab8dcc1e2ef7b0c55c5a920a04844f1a930d
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

hashcheck.sh: use getopt to parse parameters and arguments

diff --git a/hashcheck.sh b/hashcheck.sh
index e33668e..8272f0a 100755
--- a/hashcheck.sh
+++ b/hashcheck.sh
@@ -28,17 +28,26 @@ ${MESSAGE_COLOR}\t-s|--section <section>\t to check whole
section
message "$usage"
}

-# process the params
-while [[ "$1" == -* ]] # 2) params
- do
+## Parse the command line parameters and arguments via getopt
+TEMP_OPTS=$(getopt -o 's:g:vdfah' -l 'section:,grimoire:,verbose,download,\
+remove-failed,remove-all,help' \
+-n "$(basename $0)" -- "$@")
+if [[ $? != 0 ]]; then show_usage; exit 3; fi
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP_OPTS"
+unset TEMP_OPTS
+
+while true; do
case "$1" in
"-s"|"--section") wanted_spells=$(codex_get_spells_in_section
$(codex_find_section_by_name $2)|cut -f8 -d/); shift 2;;
"-g"|"--grimoire") wanted_spells=$(codex_get_all_spells
$(codex_find_grimoire $2)| cut -f8 -d/); shift 2;;
"-v"|"--verbose") verbose_mode="on" ; shift ;;
"-d"|"--download") re_download="-d"; shift ;;
- "-rf"|"--remove-failed") remove_sources="failed"; shift ;;
- "-ra"|"--remove-all") remove_sources="all"; shift ;;
- "-h"|"--help"|*) show_usage; exit 2 ;;
+ "-f"|"--remove-failed") remove_sources="failed"; shift ;;
+ "-a"|"--remove-all") remove_sources="all"; shift ;;
+ "-h"|"--help") show_usage; exit 2 ;;
+ --) shift ; break ;;
+ *) show_usage; exit 3 ;;
esac
done




  • [SM-Commit] GIT changes to master guru-tools by Bor Kraljič (d07aab8dcc1e2ef7b0c55c5a920a04844f1a930d), Bor Kraljič, 09/12/2010

Archive powered by MHonArc 2.6.24.

Top of Page