aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/rc-update.fish
diff options
context:
space:
mode:
Diffstat (limited to 'share/completions/rc-update.fish')
-rw-r--r--share/completions/rc-update.fish33
1 files changed, 33 insertions, 0 deletions
diff --git a/share/completions/rc-update.fish b/share/completions/rc-update.fish
new file mode 100644
index 00000000..f2339699
--- /dev/null
+++ b/share/completions/rc-update.fish
@@ -0,0 +1,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)"