Permalink
Browse files

Feature: sm --verbose --trace {extension} {action}; very useful for d…

…ebugging :)
  • Loading branch information...
1 parent 7acee1d commit 83b07f855e08961fc96c77d62d23ad3eebb70c7a @wayneeseguin wayneeseguin committed Nov 18, 2011
@@ -158,8 +158,7 @@ package()
__sm.package.${_command} "${package_name}" "${package_version}"
;;
(initialize)
- declare -a package_dependencies
- declare -a configure_flags
+ typeset -a package_dependencies configure_flags
__sm.package.init
;;
(error)
@@ -105,5 +105,6 @@ install_sm_scm()
chmod 0755 ${PWD}/install ${PWD}/bin/*
- exec bash ${PWD}/install --trace="$trace_flags" --debug="$debug_flags"
+ exec bash ${PWD}/install \
+ --trace="${trace_flags}" --debug="${debug_flags}" --verbose="${verbose_flag}"
}
View
@@ -3,14 +3,18 @@
set +o nounset
set +o noclobber
-: ${debug_flags:="-search"} ${debug_flag:=0} ${trace_flags:="-search -backtrace"} ${trace_flag:=0} ${var_debug_type_flag:="long"}
-declare -a var_debug_flags trace_functions
+: \
+ ${debug_flags:="-search"} ${debug_flag:=0} \
+ ${trace_flags:="-search -backtrace"} ${trace_flag:=0} \
+ ${verbose_flag:=0} \
+ ${var_debug_type_flag:="long"}
+
+typeset -a var_debug_flags trace_functions trace_flags
while (( $# > 0 ))
do
token="$1"
case "$token" in
-
(--help)
shift #end of processing
extension_args=("cli" "help" "$@")
@@ -35,6 +39,10 @@ do
trace_functions+=( ${=token##--fun-trace\=} )
;;
+ (--verbose)
+ verbose_flag=1
+ ;;
+
(--debug)
debug_flags+=" all"
debug_flag=1
@@ -96,6 +104,7 @@ then
fi
PS4="+%x:%I %N():%i > "
+
export PS4
if [[ " ${trace_flags} " =~ " all " ]]
@@ -107,4 +116,6 @@ fi
debug_flags="${debug_flags## }"
trace_flags="${trace_flags## }"
-export debug_flag debug_flags trace_flag trace_flags extension_args sm_script var_debug_flags var_debug_type_flag
+export debug_flag debug_flags trace_flag trace_flags verbose_flag extension_args \
+ sm_script var_debug_flags var_debug_type_flag
+
@@ -6,7 +6,7 @@
__sm.exports()
{ # TODO: Filter this list of exports down.
- export sm_path __sm_modules_path action archives_path branch config_path database database_name debug_flag environment error_message extension extension_action extension_args extension_bin_path extension_config_path extension_modules_path extension_path extension_templates_path flags framework head_flag hooks_flag keep_releases old_releases parse_break paths previous_path project project_path release_path remote repository result revision shared_path src_path templates_path timestamp tmp_path trace_flag user extension_log_path packages_path
+ export sm_path __sm_modules_path action archives_path branch config_path database database_name debug_flag verbose_flag environment error_message extension extension_action extension_args extension_bin_path extension_config_path extension_modules_path extension_path extension_templates_path flags framework head_flag hooks_flag keep_releases old_releases parse_break paths previous_path project project_path release_path remote repository result revision shared_path src_path templates_path timestamp tmp_path trace_flag user extension_log_path packages_path
}
# Examples
@@ -442,7 +442,10 @@ __sm.actions.source()
script="$1"
(( $# )) && shift || __sm.log.fail "No script was given as the first parameter."
[[ -r "$script" ]] || __sm.log.fail "Could not find script to run: $script."
+ if (( verbose_flag )) ; then PS4="> "; fi # Yes this is done before the xtrace
trace_filter action || set -o xtrace
+ if (( verbose_flag )) ; then set -v ; fi
+
source "$script"
}
@@ -4,7 +4,7 @@ true \
${debug_flags:="-search"} ${debug_flag:=0} ${trace_flags:="-search -backtrace"} \
${trace_flag:=0} ${var_debug_type_flag:="long"} "${log_path:="${sm_path}/log"}"
-declare -a var_debug_flags
+typeset -a var_debug_flags
__sm_trace_filter_stack=()

0 comments on commit 83b07f8

Please sign in to comment.