wakeonlan.plugin.zsh 472 Bytes
Newer Older
1
function wake() {
2
3
  local config_file="$HOME/.wakeonlan/$1"
  if [[ ! -f "$config_file" ]]; then
4
    echo "ERROR: There is no configuration file at \"$config_file\"."
5
    return 1
6
7
  fi

8
  if (( ! $+commands[wakeonlan] )); then
9
    echo "ERROR: Can't find \"wakeonlan\".  Are you sure it's installed?"
10
    return 1
11
12
13
14
  fi

  wakeonlan -f $config_file
}
15
16
17
18

if (( $+functions[compdef] )); then
  compdef "_arguments '1:device to wake:_files -W '\''$HOME/.wakeonlan'\'''" wake
fi