diff options
author | kate.ward <kate.ward@forestent.com> | 2008-07-11 15:33:23 +0000 |
---|---|---|
committer | kate.ward <kate.ward@forestent.com> | 2008-07-11 15:33:23 +0000 |
commit | 1d0ecc466906f1db8c1f2fb5fff9b13f9b2f8ce2 (patch) | |
tree | 5ebc22ea5e46b8b51b48f94e8acfcdf766ddfc15 /source | |
parent | f32fb4ff4ecd173815fffd0473dfc20ceeae4d71 (diff) | |
download | shflags-1d0ecc466906f1db8c1f2fb5fff9b13f9b2f8ce2.tar.gz |
fixed problems with help; changed zsh checks
Diffstat (limited to 'source')
-rw-r--r-- | source/1.0/doc/CHANGES-1.0.txt | 6 | ||||
-rw-r--r-- | source/1.0/src/shflags | 10 | ||||
-rwxr-xr-x | source/1.0/src/shflags_test.sh | 7 | ||||
-rwxr-xr-x | source/1.0/src/shflags_test_defines.sh | 3 | ||||
-rw-r--r-- | source/1.0/src/shflags_test_helpers | 3 | ||||
-rwxr-xr-x | source/1.0/src/shflags_test_parsing.sh | 3 | ||||
-rwxr-xr-x | source/1.0/src/shflags_test_private.sh | 3 | ||||
-rwxr-xr-x | source/1.0/src/shflags_test_public.sh | 3 |
8 files changed, 31 insertions, 7 deletions
diff --git a/source/1.0/doc/CHANGES-1.0.txt b/source/1.0/doc/CHANGES-1.0.txt index 4fe5324..2d55d64 100644 --- a/source/1.0/doc/CHANGES-1.0.txt +++ b/source/1.0/doc/CHANGES-1.0.txt @@ -8,6 +8,12 @@ Fixed bug where the help output added [no] to all flag names Added additional example files that are referenced by the documentation. +Improved zsh version and option checking. + +Upgraded shUnit2 to 2.1.4 + +Added unit testing for the help output. + Changes with 1.0.0 ------------------ diff --git a/source/1.0/src/shflags b/source/1.0/src/shflags index 08216fc..0e34287 100644 --- a/source/1.0/src/shflags +++ b/source/1.0/src/shflags @@ -79,8 +79,9 @@ FLAGS_ERROR=2 # specific shell checks if [ -n "${ZSH_VERSION:-}" ]; then - if [ "`set -o |grep "^shwordsplit" |awk '{print $2}'`" = 'off' ]; then - _flags_fatal 'shwordsplit is required for proper operation' + setopt |grep "^shwordsplit$" >/dev/null + if [ $? -ne ${FLAGS_TRUE} ]; then + _flags_fatal 'zsh shwordsplit option is required for proper zsh operation' exit ${FLAGS_ERROR} fi if [ -z "${FLAGS_PARENT:-}" ]; then @@ -156,7 +157,10 @@ __FLAGS_TYPE_STRING=4 _flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'` for _flags_const in ${_flags_constants}; do if [ -n "${ZSH_VERSION:-}" ]; then - readonly -g ${_flags_const} # declare readonly constants globally + case ${ZSH_VERSION} in + [123].*) readonly ${_flags_const} ;; + *) readonly -g ${_flags_const} ;; # declare readonly constants globally + esac else readonly ${_flags_const} fi diff --git a/source/1.0/src/shflags_test.sh b/source/1.0/src/shflags_test.sh index 0a58c90..0cbfdbc 100755 --- a/source/1.0/src/shflags_test.sh +++ b/source/1.0/src/shflags_test.sh @@ -100,7 +100,6 @@ for shell in ${shells}; do EOF shell_name=`basename ${shell}` - shell_opts='' case ${shell_name} in bash) echo; ${shell} --version; ;; dash) ;; @@ -114,9 +113,9 @@ EOF ;; pdksh) ;; zsh) - shell_opts='-o shwordsplit --' + version=`echo 'echo ${ZSH_VERSION}' |${shell}` echo - ${shell} --version + echo "version: ${version}" ;; esac @@ -125,7 +124,7 @@ EOF suiteName=`expr "${suite}" : "${PREFIX}\(.*\).sh"` echo echo "--- Executing the '${suiteName}' test suite ---" >&2 - ( exec ${shell} ${shell_opts} ./${suite}; ) + ( exec ${shell} ./${suite}; ) done done diff --git a/source/1.0/src/shflags_test_defines.sh b/source/1.0/src/shflags_test_defines.sh index caf2eb8..5e2f899 100755 --- a/source/1.0/src/shflags_test_defines.sh +++ b/source/1.0/src/shflags_test_defines.sh @@ -11,6 +11,9 @@ # load test helpers . ./shflags_test_helpers +# set shwordsplit for zsh +[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit + #------------------------------------------------------------------------------ # suite tests # diff --git a/source/1.0/src/shflags_test_helpers b/source/1.0/src/shflags_test_helpers index 0c0cdb6..1ecddc7 100644 --- a/source/1.0/src/shflags_test_helpers +++ b/source/1.0/src/shflags_test_helpers @@ -9,6 +9,9 @@ __th_skipping=0 +# set shwordsplit for zsh +[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit + # my name TH_MY_NAME=`basename "$0"` diff --git a/source/1.0/src/shflags_test_parsing.sh b/source/1.0/src/shflags_test_parsing.sh index f208cca..7d84f14 100755 --- a/source/1.0/src/shflags_test_parsing.sh +++ b/source/1.0/src/shflags_test_parsing.sh @@ -13,6 +13,9 @@ # load test helpers . ./shflags_test_helpers +# set shwordsplit for zsh +[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit + #------------------------------------------------------------------------------ # suite tests # diff --git a/source/1.0/src/shflags_test_private.sh b/source/1.0/src/shflags_test_private.sh index 0389cd0..9f8d4ce 100755 --- a/source/1.0/src/shflags_test_private.sh +++ b/source/1.0/src/shflags_test_private.sh @@ -11,6 +11,9 @@ # load test helpers . ./shflags_test_helpers +# set shwordsplit for zsh +[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit + #------------------------------------------------------------------------------ # suite tests # diff --git a/source/1.0/src/shflags_test_public.sh b/source/1.0/src/shflags_test_public.sh index 2ab5902..933e596 100755 --- a/source/1.0/src/shflags_test_public.sh +++ b/source/1.0/src/shflags_test_public.sh @@ -11,6 +11,9 @@ # load test helpers . ./shflags_test_helpers +# set shwordsplit for zsh +[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit + #------------------------------------------------------------------------------ # suite tests # |