2016-10-22 19:26:00 +02:00
|
|
|
_pihole() {
|
2024-08-15 02:31:33 +02:00
|
|
|
local cur prev opts opts_checkout opts_debug opts_logging opts_query opts_update opts_version
|
2024-07-02 20:52:44 +02:00
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
prev2="${COMP_WORDS[COMP_CWORD-2]}"
|
2016-04-03 00:58:10 +02:00
|
|
|
|
2024-07-02 20:52:44 +02:00
|
|
|
case "${prev}" in
|
|
|
|
"pihole")
|
2024-08-26 19:44:42 +02:00
|
|
|
opts="allow allow-regex allow-wild deny checkout debug disable enable flush help logging query reconfigure regex restartdns status tail uninstall updateGravity updatePihole version wildcard arpflush api"
|
2024-07-02 20:52:44 +02:00
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
;;
|
2024-08-15 02:31:33 +02:00
|
|
|
"allow"|"deny"|"wildcard"|"regex"|"allow-regex"|"allow-wild")
|
2024-07-08 19:18:21 +02:00
|
|
|
opts_lists="\not \--delmode \--quiet \--list \--help"
|
2024-07-02 20:52:44 +02:00
|
|
|
COMPREPLY=( $(compgen -W "${opts_lists}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"checkout")
|
|
|
|
opts_checkout="core ftl web master dev"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_checkout}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"debug")
|
|
|
|
opts_debug="-a"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_debug}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"logging")
|
|
|
|
opts_logging="on off 'off noflush'"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_logging}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"query")
|
|
|
|
opts_query="--partial --all"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_query}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"updatePihole"|"-up")
|
|
|
|
opts_update="--check-only"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_update}" -- ${cur}) )
|
|
|
|
;;
|
|
|
|
"core"|"admin"|"ftl")
|
|
|
|
if [[ "$prev2" == "checkout" ]]; then
|
|
|
|
opts_checkout="master dev"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts_checkout}" -- ${cur}) )
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
2016-04-03 00:58:10 +02:00
|
|
|
}
|
2016-10-22 19:26:00 +02:00
|
|
|
complete -F _pihole pihole
|