Permalink
Browse files

merge in jason v0.0.6 for working sub implementation

  • Loading branch information...
defn committed Oct 6, 2012
1 parent b016e0a commit 9d625ac391944ae34e65a51c799a142d0c59fbfe
Showing with 28 additions and 24 deletions.
  1. +8 −5 bin/_jason
  2. +0 −1 bin/_shflags
  3. +7 −5 bin/_sub
  4. +4 −4 bin/bump
  5. +2 −2 libexec/jason
  6. +4 −4 libexec/jason-bourne
  7. +3 −3 libexec/jason-bourne-again
View
@@ -28,8 +28,11 @@ function check_help {
}
function display_help {
+ flags_help
+ echo
+
# taken from shocco
- grep '^#/' <"$shome/bin/$(basename -- "$0")" | cut -c4-
+ grep '^#/' <"$shome/$(basename $(dirname -- "$0"))/$(basename -- "$0")" | cut -c4-
}
# Exits the script with the last error code. Servers as a marker in $0 to
@@ -108,11 +111,11 @@ function parse_command_line {
fi
if ! FLAGS "$@"; then
- if [[ "$flags_error" = "help requested" ]]; then
+ if [[ "$flags_error" = "help requested" ]]; then
echo ""
- display_help
- exit 0
- fi
+ display_help
+ exit 0
+ fi
return 4
fi
View
@@ -749,7 +749,6 @@ _flags_parseGetopt()
# handle special case help flag
if [ "${_flags_name_}" = 'help' ]; then
if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then
- flags_help
flags_error='help requested'
flags_return=${FLAGS_FALSE}
break
View
@@ -3,10 +3,13 @@
function sub {
local bsource="$1"; shift
local sub_base="$(basename "$bsource")"
+ local sub_cmd="$shome/libexec/${sub_base}"
- FLAGS_SUB="$FLAGS_TRUE"
- parse_command_line "$@" || exit $?
- eval set -- "${FLAGS_ARGV}"
+ if [[ "$sub_cmd" == "$bsource" ]]; then
+ FLAGS_SUB="$FLAGS_TRUE"
+ parse_command_line "$@" || exit $?
+ eval set -- "${FLAGS_ARGV}"
+ fi
if [[ "$#" > 0 ]]; then
if [[ ! "$1" =~ ^- ]]; then
@@ -21,8 +24,7 @@ function sub {
fi
fi
fi
-
- local sub_cmd="$shome/libexec/${sub_base}"
+
if [[ -x "$sub_cmd" && "$sub_cmd" != "$bsource" ]]; then
exec "$sub_cmd" "$@"
else
View
@@ -18,6 +18,10 @@ require 'bump'
# entry point
function main {
+ if [[ "$#" = 0 ]]; then
+ set -- patch
+ fi
+
bump_version "$FLAGS_dirty" "$@"
}
@@ -26,9 +30,5 @@ DEFINE_boolean 'dirty' "$FLAGS_FALSE" 'force bumping in unclean work area' 'f'
parse_command_line "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
-if [[ "$#" = 0 ]]; then
- set -- patch
-fi
-
# pass arguments to entry point
main "$@"
View
@@ -13,11 +13,11 @@ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
source "$shome/bin/_treadstone"
# parse the command-line
-DEFINE_boolean 'nancy' "$FLAGS_FALSE" 'What is her name?' 'n'
+DEFINE_string 'name' "Nancy" 'What is her name?' 'n'
# entry point
function main {
- echo "$FLAGS_nancy"
+ echo "His girlfriend is $FLAGS_name"
}
require 'sub' "$BASH_SOURCE" "$@"
View
@@ -1,10 +1,10 @@
#!/bin/bash
#/ NAME
-#/ jason-bourne-again -- uses the jason bourne lib
+#/ jason-bourne -- uses the jason bourne lib
#/
#/ SYNOPSIS
-#/ jason bourne again
+#/ jason bourne
# figure out the project root under which bin, lib live
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
@@ -13,11 +13,11 @@ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
source "$shome/bin/_treadstone"
# parse the command-line
-DEFINE_string 'sequel' "fists" 'supremacy' 's'
+DEFINE_string 'weapons' "fists" 'supremacy' 's'
# entry point
function main {
- echo "$FLAGS_sequel"
+ echo "He fights with $FLAGS_weapons"
}
require 'sub' "$BASH_SOURCE" "$@"
@@ -1,10 +1,10 @@
#!/bin/bash
#/ NAME
-#/ jason-bourne -- uses the jason bourne lib
+#/ jason-bourne-again -- uses the jason bourne lib
#/
#/ SYNOPSIS
-#/ jason bourne
+#/ jason bourne again
# figure out the project root under which bin, lib live
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
@@ -17,7 +17,7 @@ DEFINE_string 'sequel' "again" 'Name of sequel' 's'
# entry point
function main {
- echo "$FLAGS_sequel"
+ echo "He stars in $FLAGS_sequel"
}
require 'sub' "$BASH_SOURCE" "$@"

0 comments on commit 9d625ac

Please sign in to comment.