summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-08-17 10:43:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-08-17 10:43:57 +0200
commitcfdd50546cf3c767b596a82eb8f406684dd806c4 (patch)
treecad2d2435df8adc0c5096dc98a0fe0bba4fd9e5d
parent5b3d8a2b48fe10dee44c24a541cab809059780f9 (diff)
Remove help function, run-help is way better
-rw-r--r--etc/functions/help57
1 files changed, 0 insertions, 57 deletions
diff --git a/etc/functions/help b/etc/functions/help
deleted file mode 100644
index bad1b75..0000000
--- a/etc/functions/help
+++ /dev/null
@@ -1,57 +0,0 @@
-## vim:ft=zsh
-## wrapper around man, finfo, etc
-## Usage: help <topic>
-typeset -a methods
-typeset method topic
-typeset -i found check_only all
-methods=(man zshfunction zshbuiltin apt)
-
-while [[ ${1} == -* ]] {
- case ${1} in
- -a|--all) all=1 ;;
- -c|--check-only) check_only=1 ;;
- -t|--topic) topic=${2}; shift ;;
- -|--) shift; break ;;
- *) echo "unknown option: ${1}" ;;
- esac
- shift
-}
-
-function help_check_man { man -w ${1} &> /dev/null }
-function help_check_zshfunction { whichf ${1} &> /dev/null }
-function help_check_zshbuiltin { (( ${+builtins[$1]} )) }
-function help_check_apt {
- [[ ${commands[$1]} != ${HOME}* ]] && [[ -n ${commands[$1]} ]] && [[ -n ${commands[apt-file]} ]]
-}
-
-function help_show_man { man ${1} }
-function help_show_zshfunction { finfo ${1} }
-function help_show_zshbuiltin { man zshbuiltins | less -p " ${1}" }
-function help_show_apt {
- apt-cache show ${(s/:/)$(apt-file search -F ${commands[$1]})[1]}
-}
-
-if [[ -z ${1} ]] {
- echo "Usage: help <command>" > /dev/stderr
- return 1
-}
-
-for method in ${methods}; {
- if [[ -n ${topic} && ${method} != ${topic} ]] {
- continue
- }
- if help_check_${method} ${1}; then
- ((found++))
- if ((check_only)) {
- echo ${method}
- continue
- }
- help_show_${method} ${1}
- ((all)) || break
- fi
-}
-
-if ((found == 0)) {
- echo "Sorry, no clue." > /dev/stderr
- return 1
-}