summaryrefslogtreecommitdiff
path: root/plugins/wakeonlan
diff options
context:
space:
mode:
authorPaul Gideon Dann <pdgiddie@gmail.com>2011-09-19 12:40:29 +0100
committerPaul Gideon Dann <pdgiddie@gmail.com>2011-09-19 12:43:04 +0100
commit14411cb904b7682fe2a5c69861bfffa96f124707 (patch)
tree0ba6aaa23d6a7d25746243103f57b1b9cc489c06 /plugins/wakeonlan
parent1d9eacb34f59f3bf82a9de0d7b474cb4c501e3fd (diff)
downloadzsh-14411cb904b7682fe2a5c69861bfffa96f124707.tar.gz
zsh-14411cb904b7682fe2a5c69861bfffa96f124707.tar.bz2
zsh-14411cb904b7682fe2a5c69861bfffa96f124707.zip
Tweaks to the wakeonlan plugin
These were suggested by sorin-ionescu in pull request #343.
Diffstat (limited to 'plugins/wakeonlan')
-rw-r--r--plugins/wakeonlan/wakeonlan.plugin.zsh15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/wakeonlan/wakeonlan.plugin.zsh b/plugins/wakeonlan/wakeonlan.plugin.zsh
index 08db1bdea..752bfc600 100644
--- a/plugins/wakeonlan/wakeonlan.plugin.zsh
+++ b/plugins/wakeonlan/wakeonlan.plugin.zsh
@@ -1,15 +1,18 @@
function wake() {
- local config_file=~/.wakeonlan/$1
- if [[ ! -f $config_file ]]; then
+ local config_file="$HOME/.wakeonlan/$1"
+ if [[ ! -f "$config_file" ]]; then
echo "ERROR: There is no configuration file at \"$config_file\"."
- return
+ return 1
fi
- which wakeonlan > /dev/null
- if [[ ! $? == 0 ]]; then
+ if (( ! $+commands[wakeonlan] )); then
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
- return
+ return 1
fi
wakeonlan -f $config_file
}
+
+if (( $+functions[compdef] )); then
+ compdef "_arguments '1:device to wake:_files -W '\''$HOME/.wakeonlan'\'''" wake
+fi