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:
Fabian Homborg 2020-09-19 11:39:51 +02:00
parent 21077c0c9a
commit a3e20a4d38
13 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
function __history_completions --argument limit function __history_completions --argument-names limit
if string match -q "" -- "$limit" if string match -q "" -- "$limit"
set limit 25 set limit 25
end end

View File

@ -9,7 +9,7 @@ function __fish_phpunit_list_groups
end end
# Lists PHPUnit objects corresponding to the given option # 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 # Use the same PHPUnit binary as in the command being completed
set -l phpunit (commandline -opc)[1] set -l phpunit (commandline -opc)[1]
test -x $phpunit test -x $phpunit

View File

@ -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)" complete -c ssh -s c -d "Encryption cipher" -xa "(ssh -Q cipher)"
# Also retrieve `user@host` entries from history # Also retrieve `user@host` entries from history
function __ssh_history_completions --argument limit function __ssh_history_completions --argument-names limit
if string match -q "" if string match -q ""
set limit 100 set limit 100
end end

View File

@ -17,7 +17,7 @@ complete -xc valgrind -l $skin -d Skin -a "
massif\tHeap\ profiler 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) set -l cmd (commandline -cpo)
# Quote $cmd so the tokens are separated with a space # Quote $cmd so the tokens are separated with a space
if string match -qr -- "--$skin(=| )$tool" "$cmd" if string match -qr -- "--$skin(=| )$tool" "$cmd"

View File

@ -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] set -q cfgfiles[1]
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc

View File

@ -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 -e argv[1]
set -l str (commandline -tc | string replace -rf "(.*$sep)[^$sep]*" '$1' | string replace -r -- '--.*=' '') set -l str (commandline -tc | string replace -rf "(.*$sep)[^$sep]*" '$1' | string replace -r -- '--.*=' '')
printf "%s\n" "$str"$argv printf "%s\n" "$str"$argv

View File

@ -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 switch $what
case format Format 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/' 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/'

View File

@ -3,7 +3,7 @@
# with description $argv[2] if defined, otherwise use 'Directory'. # with description $argv[2] if defined, otherwise use 'Directory'.
# If no arguments are provided, attempts to complete current commandline token. # 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] if not set -q desc[1]
set desc Directory set desc Directory
end end

View File

@ -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] if not set -q cmd[1]
echo "Usage: echo "Usage:
__fish_complete_list <separator> <function> <prefix> <itemprefix> __fish_complete_list <separator> <function> <prefix> <itemprefix>

View File

@ -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 1 -d "Protocol version 1 only"
complete -c $command -s 2 -d "Protocol version 2 only" complete -c $command -s 2 -d "Protocol version 2 only"
complete -c $command -s 4 -d "IPv4 addresses only" complete -c $command -s 4 -d "IPv4 addresses only"

View File

@ -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 # Add a fake element to increment without calling math
set -l num (count (commandline -poc) additionalelement) set -l num (count (commandline -poc) additionalelement)
test $n -eq $num test $n -eq $num

View File

@ -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 switch $item
case . case .
set item source set item source

View File

@ -160,7 +160,7 @@ end
# Required, optional, and multiple flags # Required, optional, and multiple flags
begin 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 set -l
# CHECK: _flag_a ABC # CHECK: _flag_a ABC
# CHECK: _flag_abc ABC # CHECK: _flag_abc ABC