mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
Don't use abbreviated long options
"function --argument" is not a thing, it's "--argument-names". This only accidentally works because our getopt is awful and allows abbreviated long options. Similarly, one argparse test used "--d" instead of "-d" or "--def".
This commit is contained in:
parent
21077c0c9a
commit
a3e20a4d38
13 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
function __history_completions --argument limit
|
||||
function __history_completions --argument-names limit
|
||||
if string match -q "" -- "$limit"
|
||||
set limit 25
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ function __fish_phpunit_list_groups
|
|||
end
|
||||
|
||||
# Lists PHPUnit objects corresponding to the given option
|
||||
function __fish_phpunit_list --argument option
|
||||
function __fish_phpunit_list --argument-names option
|
||||
# Use the same PHPUnit binary as in the command being completed
|
||||
set -l phpunit (commandline -opc)[1]
|
||||
test -x $phpunit
|
||||
|
|
|
@ -54,7 +54,7 @@ complete -c ssh -s D -d "Dynamic port forwarding"
|
|||
complete -c ssh -s c -d "Encryption cipher" -xa "(ssh -Q cipher)"
|
||||
|
||||
# Also retrieve `user@host` entries from history
|
||||
function __ssh_history_completions --argument limit
|
||||
function __ssh_history_completions --argument-names limit
|
||||
if string match -q ""
|
||||
set limit 100
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ complete -xc valgrind -l $skin -d Skin -a "
|
|||
massif\tHeap\ profiler
|
||||
"
|
||||
|
||||
function __fish_valgrind_skin --argument tool -V skin
|
||||
function __fish_valgrind_skin --argument-names tool -V skin
|
||||
set -l cmd (commandline -cpo)
|
||||
# Quote $cmd so the tokens are separated with a space
|
||||
if string match -qr -- "--$skin(=| )$tool" "$cmd"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles
|
||||
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument-names cfgfiles
|
||||
set -q cfgfiles[1]
|
||||
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_append -d "Internal completion function for appending string to the commandline" --argument sep
|
||||
function __fish_append -d "Internal completion function for appending string to the commandline" --argument-names sep
|
||||
set -e argv[1]
|
||||
set -l str (commandline -tc | string replace -rf "(.*$sep)[^$sep]*" '$1' | string replace -r -- '--.*=' '')
|
||||
printf "%s\n" "$str"$argv
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_complete_convert_options --description 'Complete Convert options' --argument what
|
||||
function __fish_complete_convert_options --description 'Complete Convert options' --argument-names what
|
||||
switch $what
|
||||
case format Format
|
||||
convert -list Format | sed '1,/----/d; /^$/,$d; /^$/d; s/^\s*\([a-zA-Z0-9-]\+\)\**\s*\S\+\s\+\\(\S\+\)\s\+\(.\+\S\)\s*$/\1\t\2 \3/'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# with description $argv[2] if defined, otherwise use 'Directory'.
|
||||
# If no arguments are provided, attempts to complete current commandline token.
|
||||
#
|
||||
function __fish_complete_directories -d "Complete directory prefixes" --argument comp desc
|
||||
function __fish_complete_directories -d "Complete directory prefixes" --argument-names comp desc
|
||||
if not set -q desc[1]
|
||||
set desc Directory
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_complete_list --argument div cmd prefix iprefix
|
||||
function __fish_complete_list --argument-names div cmd prefix iprefix
|
||||
if not set -q cmd[1]
|
||||
echo "Usage:
|
||||
__fish_complete_list <separator> <function> <prefix> <itemprefix>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_complete_ssh -d "common completions for ssh commands" --argument command
|
||||
function __fish_complete_ssh -d "common completions for ssh commands" --argument-names command
|
||||
complete -c $command -s 1 -d "Protocol version 1 only"
|
||||
complete -c $command -s 2 -d "Protocol version 2 only"
|
||||
complete -c $command -s 4 -d "IPv4 addresses only"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument n
|
||||
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument-names n
|
||||
# Add a fake element to increment without calling math
|
||||
set -l num (count (commandline -poc) additionalelement)
|
||||
test $n -eq $num
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_print_help --description "Print help message for the specified fish function or builtin" --argument item error_message
|
||||
function __fish_print_help --description "Print help message for the specified fish function or builtin" --argument-names item error_message
|
||||
switch $item
|
||||
case .
|
||||
set item source
|
||||
|
|
|
@ -160,7 +160,7 @@ end
|
|||
|
||||
# Required, optional, and multiple flags
|
||||
begin
|
||||
argparse h/help 'a/abc=' 'd/def=?' 'g/ghk=+' -- help --help me --ghk=g1 --abc=ABC --ghk g2 --d -g g3
|
||||
argparse h/help 'a/abc=' 'd/def=?' 'g/ghk=+' -- help --help me --ghk=g1 --abc=ABC --ghk g2 -d -g g3
|
||||
set -l
|
||||
# CHECK: _flag_a ABC
|
||||
# CHECK: _flag_abc ABC
|
||||
|
|
Loading…
Reference in a new issue