aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/rc-update.fish
blob: f2339699d0402e205020f23acaf5449a64b96dbc (plain)
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
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)"