diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-22 21:04:22 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-22 21:04:22 +0100 |
commit | 26cb7525761fd1c1c264e5002e728f458a6e5a54 (patch) | |
tree | 86a5cc04c96fdda9b0bc7e52f7cd08e01d1782b3 /etc/functions | |
parent | 4a92d24137fe74ef91297d26ba8c221be68e1f2d (diff) |
help: -c for check only, -a to show all available infos
Diffstat (limited to 'etc/functions')
-rwxr-xr-x | etc/functions/help | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/etc/functions/help b/etc/functions/help index 9a08988..62278a8 100755 --- a/etc/functions/help +++ b/etc/functions/help @@ -2,10 +2,19 @@ ## wrapper around man, finfo, etc typeset -a methods typeset method -typeset -i found=0 - +typeset -i found check_only all methods=(man function builtin apt) +while [[ $1 == -* ]] { + case $1 in + -c|--check-only) check_only=1 ;; + -a|--all) all=1 ;; + -|--) shift; break ;; + *) echo "unknown option: $1" ;; + esac + shift +} + function help_check_man { man -w $1 &> /dev/null } function help_check_function { whichf $1 &> /dev/null } function help_check_builtin { (( ${+builtins[$1]} )) } @@ -22,9 +31,13 @@ function help_show_apt { for method in $methods; { if help_check_$method $1; then - help_show_$method $1 ((found++)) - break + if ((check_only)) { + echo $method + continue + } + help_show_$method $1 + ((all)) || break fi } |