diff options
-rwxr-xr-x | bin/ct | 75 | ||||
-rw-r--r-- | man/1/ct.pod | 5 | ||||
-rw-r--r-- | man/5/caretaker.conf.pod | 4 | ||||
-rw-r--r-- | provides/zsh/completions/_ct | 3 |
4 files changed, 34 insertions, 53 deletions
@@ -17,6 +17,7 @@ setopt extended_glob typeset -a -U triggers typeset -a PKG_ROOTS CL_OPTIONS +typeset self=$0 c_info=$'\e[0;36m' c_error=$'\e[0;31m' @@ -58,8 +59,6 @@ while [[ $1 == --* ]] { --no-colours) COLOURS=0 ;; --quiet) SILENT=1 ;; --no-quiiet) SILENT=0 ;; - --debug) DEBUG=1 ;; - --no-debug) DEBUG=0 ;; --auto-update) AUTOUPDATE=1 ;; --no-auto-update) AUTOUPDATE=0 ;; --checklinks-options) CL_OPTIONS+=$2; shift ;; @@ -89,7 +88,6 @@ if (( $#PKG_ROOTS == 0 )) { : ${PKGLIST_LOCAL=0} : ${CL_OPTIONS:=--quiet} : ${SILENT=0} -: ${DEBUG=0} : ${AUTOUPDATE=1} : ${GIT_USE_ORIGIN=1} : ${COLOURS=1} @@ -98,24 +96,6 @@ export PKG_DIR export PKG_ROOT -if (( DEBUG )) { - function debug { - typeset func line - if (( $# >= 3 )) { - func=$1 - line=$2 - shift 2 - } - echo "(debug) $func:$line: $*" >&2 - } - - # I need function name and line number of the function _calling_ debug, - # so I can't get them from inside the debug function. - alias debug='debug ${(z%):-%N %i}' -} else { - function debug {} -} - if (( SILENT )) { # The goal is not to override anything set by the user... # So, an alias should be safer than fiddling with $MAKEFLAGS @@ -174,32 +154,6 @@ function pkgroot_clean { ((PKGLIST_LOCAL)) || unset PKGLIST_PATH } -if ((DEBUG)) { - info "caretaker: running in debug mode. Infos follow:\n" - echo "--- running ---" - echo " zsh $ZSH_VERSION" - echo " git "${$(git --version)[3]} - echo " caretaker "${$(git --git-dir=$PKG_DIR/${${(s:/:)$(readlink $0)}[-3]}/.git/ log -n 1)[2]} - echo "--- settings ---" - echo " PKGLIST_LOCAL $PKGLIST_LOCAL" - for PKG_ROOT in $PKG_ROOTS; { - pkgroot_parse $PKG_ROOT - echo " PKG_ROOT $PKG_ROOT" - echo " PKG_PROTO $PKG_PROTO" - echo " PKG_USER $PKG_USER" - echo " PKG_HOST $PKG_HOST" - echo " PKG_UAH $PKG_UAH" - echo " PKGLIST_PATH $PKGLIST_PATH" - pkgroot_clean - } - echo " PKG_DIR $PKG_DIR" - echo " CL_OPTIONS $CL_OPTIONS" - echo " SILENT $SILENT" - echo " COLOURS $COLOURS" - echo " PROGRESS $PROGRESS" - echo " AUTOUPDATE $AUTOUPDATE" - echo " GIT_USE_ORIGIN $GIT_USE_ORIGIN" -} function check_installed { [[ -n $1 && -d $PKG_DIR/$1 ]] || die "Package is not installed: '$1'\n" @@ -840,6 +794,32 @@ function pkg_info { show_info 'Description' $description } +function pkg_debug { + echo "--- running ---" + echo " zsh $ZSH_VERSION" + echo " git "${$(git --version)[3]} + echo " caretaker "${$(git --git-dir=$PKG_DIR/${${(s:/:)$(readlink $self)}[-3]}/.git/ log -n 1)[2]} + echo "--- settings ---" + echo " PKGLIST_LOCAL $PKGLIST_LOCAL" + for PKG_ROOT in $PKG_ROOTS; { + pkgroot_parse $PKG_ROOT + echo " PKG_ROOT $PKG_ROOT" + echo " PKG_PROTO $PKG_PROTO" + echo " PKG_USER $PKG_USER" + echo " PKG_HOST $PKG_HOST" + echo " PKG_UAH $PKG_UAH" + echo " PKGLIST_PATH $PKGLIST_PATH" + pkgroot_clean + } + echo " PKG_DIR $PKG_DIR" + echo " CL_OPTIONS $CL_OPTIONS" + echo " SILENT $SILENT" + echo " COLOURS $COLOURS" + echo " PROGRESS $PROGRESS" + echo " AUTOUPDATE $AUTOUPDATE" + echo " GIT_USE_ORIGIN $GIT_USE_ORIGIN" +} + function pkg_log { check_installed $1 vcs_log $1 @@ -868,6 +848,7 @@ case $action in wrap pkg_upgrade "$1" 'Looking for updates' ;; e|eval) eval $* ;; + debug) pkg_debug $* ;; *) die "wait, what?\nct: unknown action: '$action'\n" ;; esac diff --git a/man/1/ct.pod b/man/1/ct.pod index 444647e..98b5b13 100644 --- a/man/1/ct.pod +++ b/man/1/ct.pod @@ -78,6 +78,11 @@ Update local/remote package list (both if no argument is given) retrieve and install newest available version of I<package>. If no argument is given, updates all installed packages +=item B<debug> + +Show some information useful for debugging. +For real debugging, use zsh -x path/to/ct [...] + =back =head2 SHORT ACTIONS diff --git a/man/5/caretaker.conf.pod b/man/5/caretaker.conf.pod index ca729c4..40b58fc 100644 --- a/man/5/caretaker.conf.pod +++ b/man/5/caretaker.conf.pod @@ -60,10 +60,6 @@ Show a progress bar when performing tasks on all packages Operate in silent mode. If B<1>, it also sets PROGRESS=0 -=item B<DEBUG>=I<boolean> (--debug) [0] - -Operate in debug mode if 1 - =item B<AUTOUPDATE>=I<boolean> (--auto-update) [1] If 1, automatically execute 'ct update' before 'ct push' diff --git a/provides/zsh/completions/_ct b/provides/zsh/completions/_ct index c0af61b..29625a5 100644 --- a/provides/zsh/completions/_ct +++ b/provides/zsh/completions/_ct @@ -6,7 +6,7 @@ typeset expl function _ct_action () { _wanted action expl 'action' \ - compadd add eval remove info list \ + compadd add debug eval remove info list \ log pull push refresh status update } @@ -76,7 +76,6 @@ function _ct_args { _arguments \ '--quiet[quiet mode]' \ - '--debug[debugmode]' \ '--auto-update[automatically update package list]' \ '*--checklinks-options[options for checklinks]:option' \ '--packagedir[package directory]:directory:_files -/' \ |