aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar Elis Axelsson <elis.axelsson@gmail.com>2016-01-24 15:45:56 +0100
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-02-04 23:30:06 +0100
commit29d06760bc7055bd117b965021843784a66b3424 (patch)
treee867584de3c8bf1f73d2479ff85b70e720dc1b11 /share/completions
parent218843b9e4363afc1df12126e9d7c1f9a2c03b2f (diff)
Update eselect completions to work for the php-module
refs #1131
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/eselect.fish14
1 files changed, 12 insertions, 2 deletions
diff --git a/share/completions/eselect.fish b/share/completions/eselect.fish
index 34730299..94d31b40 100644
--- a/share/completions/eselect.fish
+++ b/share/completions/eselect.fish
@@ -17,8 +17,9 @@ function __fish_complete_eselect_action_options
set -l parseregexp 's/^ ([a-zA-Z0-9_-]*)[ ]*/\1\t/g'
set -l cmdl (commandline -poc)
- # Disable further php completion
+ # Alter further php completion
if [ (__fish_print_cmd_args_without_options)[2] = 'php' ]
+ eselect php list-modules | string split " "
return
end
@@ -33,12 +34,19 @@ function __fish_complete_eselect_action_options
__fish_eselect_cmd $cmdl[2..-1] | sed -n -re $findregexp | __fish_sgrep '^ --' | sed -re $parseregexp
end
+function __fish_complete_eselect_php_actions
+ set -l sedregexp 's/^\s*\[([0-9]+)\]\s+([A-Za-z0-9\.]+).*/\1\t\2/'
+
+ if test (__fish_print_cmd_args_without_options)[3] = 'set'
+ eselect php list (__fish_print_cmd_args_without_options)[-1] | sed -r $sedregexp
+ end
+end
+
function __fish_complete_eselect_targets
set -l sedregexp 's/^ \[([0-9]+)\][ ]*/\1\t/g'
set -l cmdl (commandline -poc)
# Disable further php completion
- # https://github.com/fish-shell/fish-shell/pull/1131
if [ (__fish_print_cmd_args_without_options)[2] = 'php' ]
return
end
@@ -72,3 +80,5 @@ complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
-xa '(__fish_complete_eselect_action_options)'
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 4" \
+ -xa '(__fish_complete_eselect_php_actions)'