sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master quill by Jaka Kranjc (8c6d7dae829506776dae22a9e069d032fbc25394)
- From: Jaka Kranjc <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master quill by Jaka Kranjc (8c6d7dae829506776dae22a9e069d032fbc25394)
- Date: Sun, 30 Nov 2008 10:36:45 -0600
GIT changes to master quill by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:
usr/bin/quill | 124
+++++++++++++-----------------------------
var/lib/quill/ChangeLog | 5 +
var/lib/quill/modules/libcore | 14 ----
var/lib/quill/version | 2
4 files changed, 46 insertions(+), 99 deletions(-)
New commits:
commit 8c6d7dae829506776dae22a9e069d032fbc25394
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* quill: redid the input parsing - now uses the powerful getopt
* libcore: removed now unneeded check_parameter
diff --git a/usr/bin/quill b/usr/bin/quill
index 0648c5e..1379a4d 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -43,102 +43,58 @@ QUILL_OUR_CONFIG_VERSION=2
QUILL_CONFIG_VERSION=$QUILL_OUR_CONFIG_VERSION
#---
-## Not really a function it's supposed to parse the command line parameters
+## Parse the command line parameters and arguments via getopt
#---
-while [[ -n $1 ]]; do
- if grep -q "^ -" <<< " $1"; then
- case $1 in
- --fmxml|-f)
- check_parameter $2
- QUILL_FETCH_MODE="fmxml"
- shift ;;
- --perlcpan|-c)
- check_parameter $2
- QUILL_FETCH_MODE="cpan"
- shift ;;
- --rubyraa|-y)
- check_parameter $2
- QUILL_FETCH_MODE="raa"
- shift ;;
- --savane|-s)
- check_parameter $2
- QUILL_FETCH_MODE="savane"
- shift ;;
- --savannah|-n)
- check_parameter $2
- QUILL_FETCH_MODE="savannah"
- shift ;;
- --gna|-g)
- check_parameter $2
- QUILL_FETCH_MODE="gna"
- shift ;;
- --fsf|-F)
- check_parameter $2
- QUILL_FETCH_MODE="fsf"
- shift ;;
- --hackagedb|-H)
- check_parameter $2
- QUILL_FETCH_MODE="hdb"
- shift ;;
+QUILL_CMDLINE=$(getopt -o fcysngFHup::amwrhv -l \
+ fmxml,perlcpan,rubyraa,savane,savannah,gna,fsf,hackagedb,update,purge:: \
+ -n 'quill' -- "$@")
+if [[ $? != 0 ]]; then
+ error_msg "Invalid command line options!"
+ sleep 1
+ quill_help 103
+fi
+eval set -- "$QUILL_CMDLINE"
+unset QUILL_CMDLINE
+
+while true; do
+ case $1 in
+ --fmxml|-f) QUILL_FETCH_MODE="fmxml" ;;
+ --perlcpan|-c) QUILL_FETCH_MODE="cpan" ;;
+ --rubyraa|-y) QUILL_FETCH_MODE="raa" ;;
+ --savane|-s) QUILL_FETCH_MODE="savane" ;;
+ --savannah|-n) QUILL_FETCH_MODE="savannah" ;;
+ --gna|-g) QUILL_FETCH_MODE="gna" ;;
+ --fsf|-F) QUILL_FETCH_MODE="fsf" ;;
+ --hackagedb|-H) QUILL_FETCH_MODE="hdb" ;;
--update|-u)
- check_parameter $2
- QUILL_UPDATE="on"
- shift ;;
- -uf|-fu)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="fmxml"
- shift ;;
- -us|-su)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="savane"
- shift ;;
- -ug|-gu)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="gna"
- shift ;;
- -un|-nu)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="savannah"
- shift ;;
- -uc|-cu)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="cpan"
- shift ;;
- -yu|-uy)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="raa"
- shift ;;
- -Fu|-uF)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="fsf"
- shift ;;
- -Hu|-uH)
- check_parameter $2
- QUILL_UPDATE="on"
- QUILL_FETCH_MODE="hdb"
- shift ;;
- --purge|-p) QUILL_MODE="purge"; quill_purge $2 ;;
+ QUILL_UPDATE="on" ;;
+ --purge|-p)
+ QUILL_MODE="purge"; quill_purge $2 ;;
--apprentice|-a) QUILL_MODE="apprentice" ;;
--mage|-m) QUILL_MODE="mage" ;;
--wizard|-w) QUILL_MODE="wizard" ;;
--reconfigure|-r) QUILL_MODE="reconfigure" ;;
--help|-h) quill_help ;;
--version|-v) quill_version ;;
+ --) shift; break ;;
*) error_msg "Invalid parameter $1"
+ sleep 1
quill_help 102 ;;
- esac
- else
- [[ -z $QUILL_TARGET ]] && QUILL_TARGET=$1
- fi
+
+ esac
shift
done
+if [[ -z $1 && -z $QUILL_TARGET ]]; then
+ error_msg "Missing spellname argument!"
+ sleep 1
+ quill_help 104
+elif [[ -n $2 ]]; then
+ message "Discarding leftover arguments!"
+fi
+if [[ -z $QUILL_TARGET ]]; then
+ QUILL_TARGET=$(tr '[[:upper:]]' '[[:lower:]]' <<< "$1")
+ QUILL_ORIG_TARGET=$1
+fi
unset -f message
. /etc/sorcery/config
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 66c888b..ac8f39b 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,4 +1,9 @@
2008-11-30 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * quill: redid the input parsing - now uses the powerful getopt
+ * libcore: removed now unneeded check_parameter
+ * version: 0.3.0-rc7
+
+2008-11-30 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libhistory: wrap when the line is longer than 76 chars
* version: 0.3.0-rc6
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index 3bbe61f..24ba348 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -387,20 +387,6 @@ Arjan 'abouter' Bouter
}
#---
-## @Synopsis checks if the parameter is missing
-## @Synopsis if not, saves it in QUILL_TARGET and QUILL_ORIG_TARGET
-##
-## @Globals QUILL_TARGET QUILL_ORIG_TARGET
-#---
-function check_parameter() {
- [[ -z $1 ]] &&
- error_msg "Missing parameter" &&
- quill_help 101 ||
- QUILL_ORIG_TARGET="$1" &&
- QUILL_TARGET=$(tr '[[:upper:]]' '[[:lower:]]' <<< "$1")
-}
-
-#---
## @Synopsis verbosely checks if the argument is a dir and optionally exits
##
## @param path
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 35a7d28..aff80e2 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.3.0-rc6
+0.3.0-rc7
- [SM-Commit] GIT changes to master quill by Jaka Kranjc (8c6d7dae829506776dae22a9e069d032fbc25394), Jaka Kranjc, 11/30/2008
Archive powered by MHonArc 2.6.24.