summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-11-21 23:20:29 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-11-21 23:20:29 +0100
commitec6c924f8791926693a515524b27eb805be50f63 (patch)
tree2018e2599e767adcbf81f021060e1daa4d0dc355
parente7ad146b035856a747781fa4fb823a24aa3f5842 (diff)
Remove check_com function
-rw-r--r--etc/functions/check_com32
-rw-r--r--etc/functions/help2
-rw-r--r--etc/functions/put2
-rw-r--r--etc/login4
-rw-r--r--etc/rc4
-rwxr-xr-xinclude/conflicts3
6 files changed, 7 insertions, 40 deletions
diff --git a/etc/functions/check_com b/etc/functions/check_com
deleted file mode 100644
index 21de466..0000000
--- a/etc/functions/check_com
+++ /dev/null
@@ -1,32 +0,0 @@
-## vim:ft=zsh
-## Check for a command/function
-## Usage: check_com [-c] <command>
-## Taken from the grml zshrc - http://grml.org
-local -i comonly
-
-if [[ ${1} == '-c' ]] ; then
- (( comonly = 1 ))
- shift
-else
- (( comonly = 0 ))
-fi
-
-if (( ${#argv} != 1 )) ; then
- printf 'usage: check_com [-c] <command>\n' >&2
- return 1
-fi
-
-if (( comonly > 0 )) ; then
- [[ -n ${commands[$1]} ]] && return 0
- return 1
-fi
-
-if [[ -n ${commands[$1]} ]] \
- || [[ -n ${functions[$1]} ]] \
- || [[ -n ${aliases[$1]} ]] \
- || [[ -n ${reswords[(r)$1]} ]] ; then
-
- return 0
-fi
-
-return 1
diff --git a/etc/functions/help b/etc/functions/help
index aa0c269..db3eca1 100644
--- a/etc/functions/help
+++ b/etc/functions/help
@@ -21,7 +21,7 @@ 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}* ]] && check_com -c $1 && check_com -c apt-file
+ [[ $commands[$1] != ${HOME}* ]] && [[ -n $commands[$1] ]] && [[ -n $commands[apt-file ]]
}
function help_show_man { man $1 }
diff --git a/etc/functions/put b/etc/functions/put
index 40e73bd..bf512c1 100644
--- a/etc/functions/put
+++ b/etc/functions/put
@@ -11,7 +11,7 @@ typeset target_dir server_prefix
typeset file remote_file illegal
typeset -i n_hosts n_ping n_curl
-if ! check_com curl; then
+if [[ -z $commands[curl] ]]; then
function curl {return 0}
warn "curl not present, won't be able to check upload success"
fi
diff --git a/etc/login b/etc/login
index 0618561..0fb05ca 100644
--- a/etc/login
+++ b/etc/login
@@ -1,4 +1,4 @@
## vim:ft=zsh
-check_com -c todo && [[ -r ~/var/gtd/todo ]] && gtd-todo
-check_com -c calendar && [[ -r ~/stuff/calendar ]] && calendar
+[[ -n $commands[todo] ]] && [[ -r ~/var/gtd/todo ]] && gtd-todo
+[[ -n $commands[calendar] ]] && [[ -r ~/stuff/calendar ]] && calendar
true
diff --git a/etc/rc b/etc/rc
index 84af81f..c34fe26 100644
--- a/etc/rc
+++ b/etc/rc
@@ -296,7 +296,7 @@ linux: salias netstat='netstat --program --all --tcp --extend' ||
# less frequent updates when running ncdu via ssh
-[[ -n $SSH_CONNECTION ]] && check_com -c ncdu && alias ncdu='ncdu -q'
+[[ -n $SSH_CONNECTION && -n $commands[ncdu] ]] && alias ncdu='ncdu -q'
alias bc='bc -l'
@@ -489,7 +489,7 @@ source $ZDIR/../provided/includes
# local configuration, not in git
xsource $ZDIR/local
-check_com envstore && eval $(envstore eval)
+[[ -n $commands[envstore] ]] && eval $(envstore eval)
# local configuration, in git
xsource $ZDIR/hosts/$HOST
diff --git a/include/conflicts b/include/conflicts
index b42e156..fb40aef 100755
--- a/include/conflicts
+++ b/include/conflicts
@@ -6,7 +6,6 @@
## source .../conflicts
## in a running, interactive zsh
-autoload check_com
typeset file dir alias
typeset PKG_DIR=$HOME/packages
typeset -a sfpath spath conflict
@@ -43,7 +42,7 @@ for file in $PKG_DIR/*/bin/*(N); {
}
for alias in ${(k)aliases}; {
- if check_com -c $alias && [[ $aliases[$alias] != (sudo |noglob |)$alias* ]]; then
+ if [[ -n $commands[$alias] ]] && [[ $aliases[$alias] != (sudo |noglob |)$alias* ]]; then
echo "conflicting alias: $alias"
fi
}