aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions
diff options
context:
space:
mode:
authorGravatar Jelte Fennema <jelte12345@gmail.com>2013-11-19 19:45:21 +0100
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2013-11-27 18:36:05 +0800
commit44d13869ad21132796f3cf55e4b8ed3fd32cac97 (patch)
treec655a99042c9cdc59cddda0518e80ee6b905c6f5 /share/functions
parent9862eb930d941a6fb93471bbb8e125076e95103a (diff)
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.
Diffstat (limited to 'share/functions')
-rw-r--r--share/functions/__fish_complete_service_actions.fish7
-rw-r--r--share/functions/__fish_number_of_cmd_args_wo_opts.fish4
-rw-r--r--share/functions/__fish_print_cmd_args.fish3
-rw-r--r--share/functions/__fish_print_cmd_args_without_options.fish3
-rw-r--r--share/functions/__fish_print_service_names.fish10
5 files changed, 27 insertions, 0 deletions
diff --git a/share/functions/__fish_complete_service_actions.fish b/share/functions/__fish_complete_service_actions.fish
new file mode 100644
index 00000000..ab91f786
--- /dev/null
+++ b/share/functions/__fish_complete_service_actions.fish
@@ -0,0 +1,7 @@
+function __fish_complete_service_actions -d "Print a list of all basic service \
+ actions"
+ set -l actions start 'Start the service'
+ set -l actions $actions stop 'Stop the service'
+ set -l actions $actions restart 'Restart the service'
+ printf "%s\t%s\n" $actions
+end
diff --git a/share/functions/__fish_number_of_cmd_args_wo_opts.fish b/share/functions/__fish_number_of_cmd_args_wo_opts.fish
new file mode 100644
index 00000000..83e3d2fa
--- /dev/null
+++ b/share/functions/__fish_number_of_cmd_args_wo_opts.fish
@@ -0,0 +1,4 @@
+function __fish_number_of_cmd_args_wo_opts
+ count (__fish_print_cmd_args_without_options)
+end
+
diff --git a/share/functions/__fish_print_cmd_args.fish b/share/functions/__fish_print_cmd_args.fish
new file mode 100644
index 00000000..eaafe65a
--- /dev/null
+++ b/share/functions/__fish_print_cmd_args.fish
@@ -0,0 +1,3 @@
+function __fish_print_cmd_args
+ commandline -poc
+end
diff --git a/share/functions/__fish_print_cmd_args_without_options.fish b/share/functions/__fish_print_cmd_args_without_options.fish
new file mode 100644
index 00000000..dadabc2a
--- /dev/null
+++ b/share/functions/__fish_print_cmd_args_without_options.fish
@@ -0,0 +1,3 @@
+function __fish_print_cmd_args_without_options
+ __fish_print_cmd_args | grep '^[^-]'
+end
diff --git a/share/functions/__fish_print_service_names.fish b/share/functions/__fish_print_service_names.fish
new file mode 100644
index 00000000..3eeb0015
--- /dev/null
+++ b/share/functions/__fish_print_service_names.fish
@@ -0,0 +1,10 @@
+function __fish_print_service_names -d 'All services known to the system'
+ if type -f systemctl >/dev/null
+ command systemctl list-units -t service | cut -d ' ' -f 1 | grep '\.service$' | sed -e 's/\.service$//'
+ else if type -f rc-service
+ command rc-service -l
+ else
+ command ls /etc/init.d
+ end
+end
+