aboutsummaryrefslogtreecommitdiffhomepage
path: root/init
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-03 01:31:51 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-03 01:31:51 +1000
commitfbe66f54aae2eefe04ebcd4844fc85328d0a1bd3 (patch)
tree117f881f8fcf274e9353cb0a4fd85c14a4fecd94 /init
parentff03fe7e41e2e0a2dbe5efdf1d9ecb08151c3d36 (diff)
Make completion of subsommands for time and sudo a bit better at differing between command and subcommand
darcs-hash:20060202153151-ac50b-d943052af165dc345366b49a5db413f635a2f28a.gz
Diffstat (limited to 'init')
-rw-r--r--init/completions/sudo.fish4
-rw-r--r--init/completions/time.fish14
-rw-r--r--init/fish_complete.fish.in16
3 files changed, 24 insertions, 10 deletions
diff --git a/init/completions/sudo.fish b/init/completions/sudo.fish
index c4ac1397..1407e746 100644
--- a/init/completions/sudo.fish
+++ b/init/completions/sudo.fish
@@ -4,5 +4,5 @@
complete -c sudo -d (_ "Command to run") -x -a "(__fish_complete_subcommand)"
-complete -c sudo -s h -d (_ "Display help and exit")
-complete -c sudo -s v -d (_ "Validate")
+complete -c sudo -s h -n "__fish_no_arguments" -d (_ "Display help and exit")
+complete -c sudo -s v -n "__fish_no_arguments" -d (_ "Validate")
diff --git a/init/completions/time.fish b/init/completions/time.fish
index 5abe2d46..6ee38288 100644
--- a/init/completions/time.fish
+++ b/init/completions/time.fish
@@ -1,11 +1,11 @@
complete -c time -a "(__fish_complete_subcommand -- -o --output -f --format)" -d (_ "Command")
-complete -c time -s f -l format -d (_ "Specify output format") -x
-complete -c time -s p -l portable -d (_ "Use the portable output format")
-complete -c time -s o -l output -d (_ "Do not send the results to stderr, but overwrite the specified file") -r
-complete -c time -s a -l append -d (_ "(Used together with -o) Do not overwrite but append")
-complete -c time -s v -l verbose -d (_ "Verbose mode")
-complete -c time -l help -d (_ "Display help and exit")
-complete -c time -s V -l version -d (_ "Display version and exit")
+complete -c time -s f -l format -n "__fish_no_arguments" -d (_ "Specify output format") -x
+complete -c time -s p -l portable -n "__fish_no_arguments" -d (_ "Use the portable output format")
+complete -c time -s o -l output -n "__fish_no_arguments" -d (_ "Do not send the results to stderr, but overwrite the specified file") -r
+complete -c time -s a -l append -n "__fish_no_arguments" -d (_ "(Used together with -o) Do not overwrite but append")
+complete -c time -s v -l verbose -n "__fish_no_arguments" -d (_ "Verbose mode")
+complete -c time -l help -n "__fish_no_arguments" -d (_ "Display help and exit")
+complete -c time -s V -l version -n "__fish_no_arguments" -d (_ "Display version and exit")
diff --git a/init/fish_complete.fish.in b/init/fish_complete.fish.in
index 1b5ae1de..f892394a 100644
--- a/init/fish_complete.fish.in
+++ b/init/fish_complete.fish.in
@@ -116,7 +116,7 @@ function __fish_complete_subcommand -d "Complete subcommand"
set res "$res $i"
else
- if contains $i $argv
+ if contains -- $i $argv
set skip_next 1
continue
end
@@ -331,6 +331,20 @@ function __fish_is_first_token -d 'Test if no non-switch argument has been speci
return 0
end
+function __fish_no_arguments -d "Internal fish function"
+ set -l cmd (commandline -poc) (commandline -tc)
+ set -e cmd[1]
+ for i in $cmd
+ switch $i
+ case '-*'
+
+ case '*'
+ return 1
+ end
+ end
+ return 0
+end
+
#
# Completions for SysV startup scripts
#