/etc/bash_completion.d/powerwake_completion is in powerwake 2.18-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # powerwake(1) completion
have powerwake &&
_powerwake()
{
local cur prev options files targets
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
options="-b --broadcast -m --method"
files="/etc/ethers /var/cache/powerwake/ethers $HOME/.cache/ethers"
targets="$( cat ${files} 2>/dev/null | awk '{print $2}' )"
case "${prev}" in
-@(b|-broadcast))
COMPREPLY=( $( compgen -W "$( LANG=C ifconfig 2>/dev/null | \
awk '/Bcast:/ {print $3}' | awk -F ':' '{print $2}' )" \
-- ${cur} ) )
return 0
;;
-@(m|-method))
COMPREPLY=( $( compgen -W "wol" -- ${cur} ) )
return 0
;;
*)
;;
esac
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $( compgen -W "${options}" -- ${cur} ) )
return 0
else
COMPREPLY=( $( compgen -W "${targets}" -- ${cur} ) );
return 0
fi
}
complete -F _powerwake powerwake
|