fish-shell/share/completions/rc-update.fish
Jelte Fennema 44d13869ad Add eselect, rc-update and rc-service completions. (These are utilities used by Gentoo Linux)
Disable php completion for the 4th part of the command, since php-eselect is differently designed and causes errors

Closes #1131.
2013-11-27 18:36:05 +08:00

33 lines
1.3 KiB
Fish

function __fish_complete_rc-update_actions
set -l actions add \
'Add the service to the runlevel or the current one if non given'
set -l actions $actions del \
'Delete the service from the runlevel or the current one if non given'
set -l actions $actions show \
'Show all enabled services and the runlevels they belong to'
printf "%s\t%s\n" $actions
end
function __fish_complete_rc-update_runlevels
set -l levels sysinit \
'First startup runlevel' \
boot \
'Second startup runlevel' \
default \
'Last startup runlevel' \
shutdown \
'Runlevel for stutting down'
printf "%s\t%s\n" $levels
end
# The first argument is what action to take with the service
complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
-xa "(__fish_complete_rc-update_actions)"
# The second argument is the names of the service, i.e. a file in /etc/init.d
complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 2" \
-xa "(__fish_print_service_names)" --description "Service name"
# The third argument is the names of the service, i.e. a file in /etc/init.d
complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
-xa "(__fish_complete_rc-update_runlevels)"