Skip to content

Commit

Permalink
fixed problems with help; changed zsh checks
Browse files Browse the repository at this point in the history
git-svn-id: http://shflags.googlecode.com/svn/trunk/source/1.0@34 9d7cb843-df4f-0410-8a79-4785ae5a3405
  • Loading branch information
kate.ward@forestent.com committed Jul 11, 2008
1 parent d3faae1 commit 3a21324
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
6 changes: 6 additions & 0 deletions doc/CHANGES-1.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------
Expand Down
10 changes: 7 additions & 3 deletions src/shflags
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/shflags_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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) ;;
Expand All @@ -114,9 +113,9 @@ EOF
;;
pdksh) ;;
zsh)
shell_opts='-o shwordsplit --'
version=`echo 'echo ${ZSH_VERSION}' |${shell}`
echo
${shell} --version
echo "version: ${version}"
;;
esac

Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/shflags_test_defines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# load test helpers
. ./shflags_test_helpers

# set shwordsplit for zsh
[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit

#------------------------------------------------------------------------------
# suite tests
#
Expand Down
3 changes: 3 additions & 0 deletions src/shflags_test_helpers
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

__th_skipping=0

# set shwordsplit for zsh
[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit

# my name
TH_MY_NAME=`basename "$0"`

Expand Down
3 changes: 3 additions & 0 deletions src/shflags_test_parsing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# load test helpers
. ./shflags_test_helpers

# set shwordsplit for zsh
[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit

#------------------------------------------------------------------------------
# suite tests
#
Expand Down
3 changes: 3 additions & 0 deletions src/shflags_test_private.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# load test helpers
. ./shflags_test_helpers

# set shwordsplit for zsh
[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit

#------------------------------------------------------------------------------
# suite tests
#
Expand Down
3 changes: 3 additions & 0 deletions src/shflags_test_public.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# load test helpers
. ./shflags_test_helpers

# set shwordsplit for zsh
[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit

#------------------------------------------------------------------------------
# suite tests
#
Expand Down

0 comments on commit 3a21324

Please sign in to comment.