1d9eacb3 |
function wake() { |
14411cb9 |
local config_file="$HOME/.wakeonlan/$1"
if [[ ! -f "$config_file" ]]; then |
1d9eacb3 |
echo "ERROR: There is no configuration file at \"$config_file\"." |
14411cb9 |
return 1 |
1d9eacb3 |
fi
|
14411cb9 |
if (( ! $+commands[wakeonlan] )); then |
1d9eacb3 |
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?" |
14411cb9 |
return 1 |
1d9eacb3 |
fi
|
aa7ddd51 |
wakeonlan -f "$config_file" |
1d9eacb3 |
} |
14411cb9 |
if (( $+functions[compdef] )); then
compdef "_arguments '1:device to wake:_files -W '\''$HOME/.wakeonlan'\'''" wake
fi |