diff --git a/po/de.po b/po/de.po index 1ca51b197..20139c73b 100644 --- a/po/de.po +++ b/po/de.po @@ -62163,7 +62163,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/en.po b/po/en.po index 66020a93a..6ada1dd44 100644 --- a/po/en.po +++ b/po/en.po @@ -62165,7 +62165,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "Test if current token is on Nth place" diff --git a/po/fr.po b/po/fr.po index 3d8af033c..c032a9d6b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -64769,7 +64769,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "Vérifier si le dossier actuel est un dépôt git" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/nb.po b/po/nb.po index dce3ade75..8dcb19a89 100644 --- a/po/nb.po +++ b/po/nb.po @@ -61917,7 +61917,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/nn.po b/po/nn.po index 01cabc0ce..3363cff25 100644 --- a/po/nn.po +++ b/po/nn.po @@ -61918,7 +61918,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/pl.po b/po/pl.po index eefd7abdb..599d45115 100644 --- a/po/pl.po +++ b/po/pl.po @@ -61940,7 +61940,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 5f4d5dd95..a7bb47975 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -87073,7 +87073,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/sv.po b/po/sv.po index 3a178e5c7..fd4b50206 100644 --- a/po/sv.po +++ b/po/sv.po @@ -57723,8 +57723,8 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 -#: share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 +#: share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index b1729b742..df0a02dd5 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -61916,7 +61916,7 @@ msgstr "" msgid "Check if the current directory is a git repository" msgstr "" -#: /tmp/fish/implicit/share/functions/__fish_is_token_n.fish:1 +#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1 msgid "Test if current token is on Nth place" msgstr "" diff --git a/share/completions/aws.fish b/share/completions/aws.fish index 7aa8bf0ba..f14013d35 100644 --- a/share/completions/aws.fish +++ b/share/completions/aws.fish @@ -270,4 +270,4 @@ set -l aws_services \ workspaces \ xray -complete -c aws -n __fish_is_first_token -xa "$aws_services" +complete -c aws -n "fish_is_nth_token 1" -xa "$aws_services" diff --git a/share/completions/bower.fish b/share/completions/bower.fish index e4f370ec2..b0dfa841f 100644 --- a/share/completions/bower.fish +++ b/share/completions/bower.fish @@ -64,7 +64,7 @@ for k,v in data["dependencies"].items(): print(k + "\t" + v[:18])' /pre script' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments post -d 'Execute /post script' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments full -d 'Force full backup' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments incr -d 'Force incremental backup' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments list -d 'List all files in backup (as it was at , default: now)' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments status -d 'Prints backup sets and chains currently in repository' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments verify -d 'List files changed since latest backup' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments purge -d 'Shows outdated backup archives [--force, delete these files]' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments purge-full -d 'Shows outdated backups [--force, delete these files]' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments cleanup -d 'Shows broken backup archives [--force, delete these files]' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments restore -d 'Restore the backup to [as it was at ]' -complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments fetch -d 'Restore single file/folder from backup [as it was at ]' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments create -d 'Creates a configuration profile' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments backup -d 'Backup with pre/post script execution' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments bkp -d 'Backup without executing pre/post scripts' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments pre -d 'Execute /pre script' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments post -d 'Execute /post script' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments full -d 'Force full backup' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments incr -d 'Force incremental backup' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments list -d 'List all files in backup (as it was at , default: now)' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments status -d 'Prints backup sets and chains currently in repository' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments verify -d 'List files changed since latest backup' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments purge -d 'Shows outdated backup archives [--force, delete these files]' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments purge-full -d 'Shows outdated backups [--force, delete these files]' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments cleanup -d 'Shows broken backup archives [--force, delete these files]' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments restore -d 'Restore the backup to [as it was at ]' +complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments fetch -d 'Restore single file/folder from backup [as it was at ]' # Options complete --command duply --no-files --long-option force -d 'Really execute the commands: purge, purge-full, cleanup' diff --git a/share/completions/git.fish b/share/completions/git.fish index 53a2b5b8e..89041f91f 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2043,7 +2043,7 @@ complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config # If no argument is specified, it's as if --get was used # Use -k with `__fish_git_config_keys` so that user defined valeus are shown first -complete -c git -n '__fish_git_using_command config; and __fish_is_token_n 3' -kfa '(__fish_git_config_keys)' +complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 3' -kfa '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config; and __fish_is_first_arg' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values matching key' -ka '(__fish_git_config_keys)' diff --git a/share/completions/meson.fish b/share/completions/meson.fish index 6a6bcd3b8..abce460d2 100644 --- a/share/completions/meson.fish +++ b/share/completions/meson.fish @@ -49,4 +49,4 @@ complete -c meson -l cross-file -r -d "File describing cross-compilation environ complete -c meson -l wrap-mode -xa 'WrapMode.{default,nofallback,nodownload,forcefallback}' -d "Special wrap mode to use" # final parameter -complete -c meson -n __fish_is_first_token -xa '(__fish_complete_directories)' +complete -c meson -n "fish_is_nth_token 1" -xa '(__fish_complete_directories)' diff --git a/share/completions/python.fish b/share/completions/python.fish index 17d694892..d0d0fbb1a 100644 --- a/share/completions/python.fish +++ b/share/completions/python.fish @@ -16,8 +16,8 @@ complete -c python -o vv -d "Even more verbose mode" complete -c python -s V -l version -d "Display version and exit" complete -c python -s W -x -d "Warning control" -a "ignore default all module once error" complete -c python -s x -d 'Skip first line of source, allowing use of non-Unix forms of #!cmd' -complete -c python -f -n __fish_is_first_token -k -a "(__fish_complete_suffix .py)" -complete -c python -f -n __fish_is_first_token -a - -d 'Read program from stdin' +complete -c python -f -n "fish_is_nth_token 1" -k -a "(__fish_complete_suffix .py)" +complete -c python -f -n "fish_is_nth_token 1" -a - -d 'Read program from stdin' # Version-specific completions # We have to detect this at runtime because pyenv etc can change diff --git a/share/completions/python2.fish b/share/completions/python2.fish index 82cd6a974..d4047915b 100644 --- a/share/completions/python2.fish +++ b/share/completions/python2.fish @@ -13,8 +13,8 @@ complete -c python2 -s v -d "Verbose mode" complete -c python2 -s V -d "Display version and exit" complete -c python2 -s W -x -d "Warning control" -a "ignore default all module once error" complete -c python2 -s x -d 'Skip first line of source, allowing use of non-Unix forms of #!cmd' -complete -c python2 -f -n __fish_is_first_token -k -a "(__fish_complete_suffix .py)" -complete -c python2 -f -n __fish_is_first_token -a - -d 'Read program from stdin' +complete -c python2 -f -n "fish_is_nth_token 1" -k -a "(__fish_complete_suffix .py)" +complete -c python2 -f -n "fish_is_nth_token 1" -a - -d 'Read program from stdin' complete -c python2 -s 3 -d 'Warn about Python 3.x incompatibilities that 2to3 cannot trivially fix' complete -c python2 -s t -d "Warn on mixed tabs and spaces" complete -c python2 -s Q -x -a "old new warn warnall" -d "Division control" diff --git a/share/completions/python3.fish b/share/completions/python3.fish index 0cac6485a..5b4447df5 100644 --- a/share/completions/python3.fish +++ b/share/completions/python3.fish @@ -13,8 +13,8 @@ complete -c python3 -s v -d "Verbose mode" complete -c python3 -s V -l version -d "Display version and exit" complete -c python3 -s W -x -d "Warning control" -a "ignore default all module once error" complete -c python3 -s x -d 'Skip first line of source, allowing use of non-Unix forms of #!cmd' -complete -c python3 -n __fish_is_first_token -k -fa "(__fish_complete_suffix .py)" -complete -c python3 -f -n __fish_is_first_token -a - -d 'Read program from stdin' +complete -c python3 -n "fish_is_nth_token 1" -k -fa "(__fish_complete_suffix .py)" +complete -c python3 -f -n "fish_is_nth_token 1" -a - -d 'Read program from stdin' complete -c python3 -s q -d 'Don\'t print version and copyright messages on interactive startup' complete -c python3 -s X -x -d 'Set implementation-specific option' -a 'faulthandler showrefcount tracemalloc showalloccount importtime dev utf8 pycache_prefex=PATH:' complete -c python3 -s b -d 'Issue warnings for possible misuse of `bytes` with `str`' diff --git a/share/completions/rustup.fish b/share/completions/rustup.fish index 9a3cdc8d7..66ae416fe 100644 --- a/share/completions/rustup.fish +++ b/share/completions/rustup.fish @@ -230,7 +230,7 @@ complete -c rustup -n __fish_should_complete_switches -s v -l verbose complete -c rustup -n __fish_should_complete_switches -s h -l help complete -c rustup -n __fish_should_complete_switches -s V -l version -complete -c rustup -n __fish_is_first_token -xa "$subcmds" +complete -c rustup -n "fish_is_nth_token 1" -xa "$subcmds" complete -c rustup -n "__fish_prev_arg_in default" -xa "$__rustup_toolchains_short $__rustup_toolchains" complete -c rustup -n "__fish_prev_arg_in toolchain" -xa "add install list remove uninstall link help" diff --git a/share/completions/s3cmd.fish b/share/completions/s3cmd.fish index 77b33a961..5283ed9cb 100644 --- a/share/completions/s3cmd.fish +++ b/share/completions/s3cmd.fish @@ -13,49 +13,49 @@ complete -c s3cmd -f -n __s3cmd_is_valid_remote_path -a "(s3cmd ls (commandline complete -c s3cmd -f -n __s3cmd_is_remote_path # Suppress file completions for initial command -complete -c s3cmd -n __fish_is_first_token -f +complete -c s3cmd -n "fish_is_nth_token 1" -f # Available commands -complete -c s3cmd -n __fish_is_first_token -a mb -d 'Make bucket' -complete -c s3cmd -n __fish_is_first_token -a rb -d 'Remove bucket' -complete -c s3cmd -n __fish_is_first_token -a ls -d 'List objects or buckets' -complete -c s3cmd -n __fish_is_first_token -a la -d 'List all object in all buckets' -complete -c s3cmd -n __fish_is_first_token -a put -d 'Put file into bucket' -complete -c s3cmd -n __fish_is_first_token -a get -d 'Get file from bucket' -complete -c s3cmd -n __fish_is_first_token -a del -d 'Delete file from bucket' -complete -c s3cmd -n __fish_is_first_token -a rm -d 'Delete file from bucket (alias for del)' -complete -c s3cmd -n __fish_is_first_token -a restore -d 'Restore file from Glacier storage' -complete -c s3cmd -n __fish_is_first_token -a sync -d 'Synchronize a directory tree to S3' -complete -c s3cmd -n __fish_is_first_token -a du -d 'Disk usage by buckets' -complete -c s3cmd -n __fish_is_first_token -a info -d 'Get various information about Buckets or Files' -complete -c s3cmd -n __fish_is_first_token -a cp -d 'Copy object' -complete -c s3cmd -n __fish_is_first_token -a modify -d 'Modify object metadata' -complete -c s3cmd -n __fish_is_first_token -a mv -d 'Move object' -complete -c s3cmd -n __fish_is_first_token -a setacl -d 'Modify Access control list for Bucket or Files' -complete -c s3cmd -n __fish_is_first_token -a setpolicy -d 'Modify Bucket Policy' -complete -c s3cmd -n __fish_is_first_token -a delpolicy -d 'Delete Bucket Policy' -complete -c s3cmd -n __fish_is_first_token -a setcors -d 'Modify Bucket CORS' -complete -c s3cmd -n __fish_is_first_token -a delcors -d 'Delete Bucket CORS' -complete -c s3cmd -n __fish_is_first_token -a payer -d 'Modify Bucket Requester Pays policy' -complete -c s3cmd -n __fish_is_first_token -a multipart -d 'Show multipart uploads' -complete -c s3cmd -n __fish_is_first_token -a abortmp -d 'Abort a multipart upload' -complete -c s3cmd -n __fish_is_first_token -a listmp -d 'List parts of a multipart upload' -complete -c s3cmd -n __fish_is_first_token -a accesslog -d 'Enable/disable bucket access logging' -complete -c s3cmd -n __fish_is_first_token -a sign -d 'Sign arbitrary string using the secret key' -complete -c s3cmd -n __fish_is_first_token -a signurl -d 'Sign an S3 URL to provide limited public access with expiry' -complete -c s3cmd -n __fish_is_first_token -a fixbucket -d 'Fix invalid file names in a bucket' -complete -c s3cmd -n __fish_is_first_token -a ws-create -d 'Create Website from bucket' -complete -c s3cmd -n __fish_is_first_token -a ws-delete -d 'Delete Website' -complete -c s3cmd -n __fish_is_first_token -a ws-info -d 'Info about Website' -complete -c s3cmd -n __fish_is_first_token -a expire -d 'Set or delete expiration rule for the bucket' -complete -c s3cmd -n __fish_is_first_token -a setlifecycle -d 'Upload a lifecycle policy for the bucket' -complete -c s3cmd -n __fish_is_first_token -a dellifecycle -d 'Remove a lifecycle policy for the bucket' -complete -c s3cmd -n __fish_is_first_token -a cflist -d 'List CloudFront distribution points' -complete -c s3cmd -n __fish_is_first_token -a cfinfo -d 'Display CloudFront distribution point parameters' -complete -c s3cmd -n __fish_is_first_token -a cfcreate -d 'Create CloudFront distribution point' -complete -c s3cmd -n __fish_is_first_token -a cfdelete -d 'Delete CloudFront distribution point' -complete -c s3cmd -n __fish_is_first_token -a cfmodify -d 'Change CloudFront distribution point parameters' -complete -c s3cmd -n __fish_is_first_token -a cfinvalinfo -d 'Display CloudFront invalidation request(s) status' +complete -c s3cmd -n "fish_is_nth_token 1" -a mb -d 'Make bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a rb -d 'Remove bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a ls -d 'List objects or buckets' +complete -c s3cmd -n "fish_is_nth_token 1" -a la -d 'List all object in all buckets' +complete -c s3cmd -n "fish_is_nth_token 1" -a put -d 'Put file into bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a get -d 'Get file from bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a del -d 'Delete file from bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a rm -d 'Delete file from bucket (alias for del)' +complete -c s3cmd -n "fish_is_nth_token 1" -a restore -d 'Restore file from Glacier storage' +complete -c s3cmd -n "fish_is_nth_token 1" -a sync -d 'Synchronize a directory tree to S3' +complete -c s3cmd -n "fish_is_nth_token 1" -a du -d 'Disk usage by buckets' +complete -c s3cmd -n "fish_is_nth_token 1" -a info -d 'Get various information about Buckets or Files' +complete -c s3cmd -n "fish_is_nth_token 1" -a cp -d 'Copy object' +complete -c s3cmd -n "fish_is_nth_token 1" -a modify -d 'Modify object metadata' +complete -c s3cmd -n "fish_is_nth_token 1" -a mv -d 'Move object' +complete -c s3cmd -n "fish_is_nth_token 1" -a setacl -d 'Modify Access control list for Bucket or Files' +complete -c s3cmd -n "fish_is_nth_token 1" -a setpolicy -d 'Modify Bucket Policy' +complete -c s3cmd -n "fish_is_nth_token 1" -a delpolicy -d 'Delete Bucket Policy' +complete -c s3cmd -n "fish_is_nth_token 1" -a setcors -d 'Modify Bucket CORS' +complete -c s3cmd -n "fish_is_nth_token 1" -a delcors -d 'Delete Bucket CORS' +complete -c s3cmd -n "fish_is_nth_token 1" -a payer -d 'Modify Bucket Requester Pays policy' +complete -c s3cmd -n "fish_is_nth_token 1" -a multipart -d 'Show multipart uploads' +complete -c s3cmd -n "fish_is_nth_token 1" -a abortmp -d 'Abort a multipart upload' +complete -c s3cmd -n "fish_is_nth_token 1" -a listmp -d 'List parts of a multipart upload' +complete -c s3cmd -n "fish_is_nth_token 1" -a accesslog -d 'Enable/disable bucket access logging' +complete -c s3cmd -n "fish_is_nth_token 1" -a sign -d 'Sign arbitrary string using the secret key' +complete -c s3cmd -n "fish_is_nth_token 1" -a signurl -d 'Sign an S3 URL to provide limited public access with expiry' +complete -c s3cmd -n "fish_is_nth_token 1" -a fixbucket -d 'Fix invalid file names in a bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a ws-create -d 'Create Website from bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a ws-delete -d 'Delete Website' +complete -c s3cmd -n "fish_is_nth_token 1" -a ws-info -d 'Info about Website' +complete -c s3cmd -n "fish_is_nth_token 1" -a expire -d 'Set or delete expiration rule for the bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a setlifecycle -d 'Upload a lifecycle policy for the bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a dellifecycle -d 'Remove a lifecycle policy for the bucket' +complete -c s3cmd -n "fish_is_nth_token 1" -a cflist -d 'List CloudFront distribution points' +complete -c s3cmd -n "fish_is_nth_token 1" -a cfinfo -d 'Display CloudFront distribution point parameters' +complete -c s3cmd -n "fish_is_nth_token 1" -a cfcreate -d 'Create CloudFront distribution point' +complete -c s3cmd -n "fish_is_nth_token 1" -a cfdelete -d 'Delete CloudFront distribution point' +complete -c s3cmd -n "fish_is_nth_token 1" -a cfmodify -d 'Change CloudFront distribution point parameters' +complete -c s3cmd -n "fish_is_nth_token 1" -a cfinvalinfo -d 'Display CloudFront invalidation request(s) status' # Created against s3cmd version 2.0 complete -c s3cmd -s h -l help -d 'Show help and exit' diff --git a/share/completions/service.fish b/share/completions/service.fish index 390d326ab..0a8ccec5c 100644 --- a/share/completions/service.fish +++ b/share/completions/service.fish @@ -1,16 +1,16 @@ # First argument is the names of the service, i.e. a file in /etc/init.d -complete -c service -n __fish_is_first_token -xa "(__fish_print_service_names)" -d Service +complete -c service -n "fish_is_nth_token 1" -xa "(__fish_print_service_names)" -d Service # as found in __fish_print_service_names.fish if test -d /run/systemd/system # Systemd systems - complete -c service -n "not __fish_is_first_token" -xa "start stop restart status enable disable" + complete -c service -n 'not fish_is_nth_token 1' -xa "start stop restart status enable disable" else if type -f rc-service 2>/dev/null # OpenRC (Gentoo) - complete -c service -n "not __fish_is_first_token" -xa "start stop restart" + complete -c service -n 'not fish_is_nth_token 1' -xa "start stop restart" else if test -d /etc/init.d # SysV on Debian and other linuxen - complete -c service -n "not __fish_is_first_token" -xa "start stop --full-restart" + complete -c service -n 'not fish_is_nth_token 1' -xa "start stop --full-restart" else # FreeBSD # Use the output of `service -v foo` to retrieve the list of service-specific verbs - complete -c service -n "not __fish_is_first_token" -xa "(__fish_complete_freebsd_service_actions)" + complete -c service -n 'not fish_is_nth_token 1' -xa "(__fish_complete_freebsd_service_actions)" end function __fish_complete_freebsd_service_actions diff --git a/share/completions/set.fish b/share/completions/set.fish index b2de4e047..dfc7b7603 100644 --- a/share/completions/set.fish +++ b/share/completions/set.fish @@ -66,35 +66,35 @@ end # # Regular switches, set only accepts these before the variable name, -# so we need to test using __fish_is_first_token +# so we need to test using "fish_is_nth_token 1" -complete -c set -n __fish_is_first_token -s e -l erase -d "Erase variable" -complete -c set -n __fish_is_first_token -s x -l export -d "Export variable to subprocess" -complete -c set -n __fish_is_first_token -s u -l unexport -d "Do not export variable to subprocess" -complete -c set -n __fish_is_first_token -s g -l global -d "Make variable scope global" -complete -c set -n __fish_is_first_token -s l -l local -d "Make variable scope local" -complete -c set -n __fish_is_first_token -s U -l universal -d "Share variable persistently across sessions" -complete -c set -n __fish_is_first_token -s q -l query -d "Test if variable is defined" -complete -c set -n __fish_is_first_token -s h -l help -d "Display help and exit" -complete -c set -n __fish_is_first_token -s n -l names -d "List the names of the variables, but not their value" -complete -c set -n __fish_is_first_token -s a -l append -d "Append value to a list" -complete -c set -n __fish_is_first_token -s p -l prepend -d "Prepend value to a list" -complete -c set -n __fish_is_first_token -s S -l show -d "Show variable" -complete -c set -n __fish_is_first_token -l path -d "Make variable as a path variable" -complete -c set -n __fish_is_first_token -l unpath -d "Make variable not as a path variable" +complete -c set -n "fish_is_nth_token 1" -s e -l erase -d "Erase variable" +complete -c set -n "fish_is_nth_token 1" -s x -l export -d "Export variable to subprocess" +complete -c set -n "fish_is_nth_token 1" -s u -l unexport -d "Do not export variable to subprocess" +complete -c set -n "fish_is_nth_token 1" -s g -l global -d "Make variable scope global" +complete -c set -n "fish_is_nth_token 1" -s l -l local -d "Make variable scope local" +complete -c set -n "fish_is_nth_token 1" -s U -l universal -d "Share variable persistently across sessions" +complete -c set -n "fish_is_nth_token 1" -s q -l query -d "Test if variable is defined" +complete -c set -n "fish_is_nth_token 1" -s h -l help -d "Display help and exit" +complete -c set -n "fish_is_nth_token 1" -s n -l names -d "List the names of the variables, but not their value" +complete -c set -n "fish_is_nth_token 1" -s a -l append -d "Append value to a list" +complete -c set -n "fish_is_nth_token 1" -s p -l prepend -d "Prepend value to a list" +complete -c set -n "fish_is_nth_token 1" -s S -l show -d "Show variable" +complete -c set -n "fish_is_nth_token 1" -l path -d "Make variable as a path variable" +complete -c set -n "fish_is_nth_token 1" -l unpath -d "Make variable not as a path variable" #TODO: add CPP code to generate list of read-only variables and exclude them from the following completions # Complete using preexisting variable names -complete -c set -n '__fish_is_first_token; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -l | string match -rv '^__' | string replace ' ' \t'Local Variable: ')" -complete -c set -n '__fish_is_first_token; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -g | string match -rv '^__' | string replace ' ' \t'Global Variable: ')" -complete -c set -n '__fish_is_first_token; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -U | string match -rv '^__' | string replace ' ' \t'Universal Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -l | string match -rv '^__' | string replace ' ' \t'Local Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -g | string match -rv '^__' | string replace ' ' \t'Global Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and not __fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s g -s U -l local -l global -l universal' -x -a "(set -U | string match -rv '^__' | string replace ' ' \t'Universal Variable: ')" # Complete some fish configuration variables even if they aren't set. -complete -c set -n '__fish_is_first_token; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_set_special_vars)" +complete -c set -n '"fish_is_nth_token 1"; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_set_special_vars)" # Complete scope-specific variables -complete -c set -n '__fish_is_first_token; and __fish_seen_argument -s l -l local' -x -a "(set -l | string replace ' ' \t'Local Variable: ')" -complete -c set -n '__fish_is_first_token; and __fish_seen_argument -s g -l global' -x -a "(set -g | string replace ' ' \t'Global Variable: ')" -complete -c set -n '__fish_is_first_token; and __fish_seen_argument -s U -l universal' -x -a "(set -U | string replace ' ' \t'Universal Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and __fish_seen_argument -s l -l local' -x -a "(set -l | string replace ' ' \t'Local Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and __fish_seen_argument -s g -l global' -x -a "(set -g | string replace ' ' \t'Global Variable: ')" +complete -c set -n '"fish_is_nth_token 1"; and __fish_seen_argument -s U -l universal' -x -a "(set -U | string replace ' ' \t'Universal Variable: ')" # Complete using preexisting variable names for `set --erase` complete -c set -n '__fish_seen_argument -s e -l erase; and not __fish_seen_argument -s l -s U -s g -l local -l global -l Universal' -f -a "(set -g | string replace ' ' \tGlobal\ Variable:\ )" diff --git a/share/completions/ttx.fish b/share/completions/ttx.fish index 6a2780c23..85a709992 100644 --- a/share/completions/ttx.fish +++ b/share/completions/ttx.fish @@ -9,7 +9,7 @@ set -l line_endings LF CR CRLF set -l woff_fmts woff woff2 complete -f -c ttx -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx; __fish_complete_suffix .ttc)' -complete -c ttx -f -n __fish_is_first_token -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx)' +complete -c ttx -f -n "fish_is_nth_token 1" -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx)' # General options complete -c ttx -f -s h -d'Show help message' diff --git a/share/completions/udevadm.fish b/share/completions/udevadm.fish index f1f70dfcf..15449a425 100644 --- a/share/completions/udevadm.fish +++ b/share/completions/udevadm.fish @@ -1,5 +1,5 @@ set -l commands info trigger settle control monitor test test-builtin -complete -c udevadm -n __fish_is_first_token -xa "$commands" +complete -c udevadm -n "fish_is_nth_token 1" -xa "$commands" complete -c udevadm -s h -l help -d "Show help" complete -c udevadm -s V -l version -d "Show version info" @@ -59,4 +59,4 @@ complete -c udevadm -n '__fish_seen_subcommand_from test' -s a -l action -d "Set complete -c udevadm -n '__fish_seen_subcommand_from test' -s N -l resolve-names -d "When to resolve names" -xa "early late never" # udevadm test-builtin -complete -c udevadm -n '__fish_seen_subcommand_from test-builtin; and __fish_is_nth_token 2' -xa "blkid\t'Filesystem and partition probing' btrfs\t'btrfs volume management' hwdb\t'Hardware database' input_id\t'Input device properties' keyboard\t'Keybord scan code to key mapping' kmod\t'Kernel module loader' net_id\t'Network device properties' net_setup_link\t'Configure network link' path_id\t'Compose persistent device path' usb_id\t'USB device properties' uaccess\t'Manage device node user ACL'" +complete -c udevadm -n '__fish_seen_subcommand_from test-builtin; and fish_is_nth_token 2' -xa "blkid\t'Filesystem and partition probing' btrfs\t'btrfs volume management' hwdb\t'Hardware database' input_id\t'Input device properties' keyboard\t'Keybord scan code to key mapping' kmod\t'Kernel module loader' net_id\t'Network device properties' net_setup_link\t'Configure network link' path_id\t'Compose persistent device path' usb_id\t'USB device properties' uaccess\t'Manage device node user ACL'" diff --git a/share/completions/unzip.fish b/share/completions/unzip.fish index a6da3eb5f..fe513b87c 100644 --- a/share/completions/unzip.fish +++ b/share/completions/unzip.fish @@ -28,7 +28,7 @@ complete -c unzip -s M -d "pipe through `more` pager" if unzip -v 2>/dev/null | string match -eq Debian # the first non-switch argument should be the zipfile - complete -c unzip -n __fish_is_first_token -k -xa '( + complete -c unzip -n "fish_is_nth_token 1" -k -xa '( __fish_complete_suffix .zip __fish_complete_suffix .jar __fish_complete_suffix .aar @@ -36,7 +36,7 @@ if unzip -v 2>/dev/null | string match -eq Debian # Files thereafter are either files to include or exclude from the operation set -l zipfile - complete -c unzip -n 'not __fish_is_first_token' -xa '(unzip -l (eval set zipfile (__fish_first_token); echo $zipfile) | string replace -r --filter ".*:\S+\s+(.*)" "\$1")' + complete -c unzip -n 'not fish_is_nth_token 1' -xa '(unzip -l (eval set zipfile (__fish_first_token); echo $zipfile) | string replace -r --filter ".*:\S+\s+(.*)" "\$1")' else diff --git a/share/completions/vips.fish b/share/completions/vips.fish index 1944cdfb1..da22df748 100644 --- a/share/completions/vips.fish +++ b/share/completions/vips.fish @@ -18,7 +18,7 @@ complete -c vips -l vips-config -d 'Print libvips config' complete -c vips -l vips-pipe-read-limit -d 'Pipe read limit (bytes)' # Operations -complete -c vips -n __fish_is_first_token -xa "(__fish_vips_ops)" +complete -c vips -n "fish_is_nth_token 1" -xa "(__fish_vips_ops)" function __fish_vips_ops vips -l | string match -rv _base | string replace -rf '^\s*\S+ \((.+?)\), +(\S.*?)(?:\s*[,(].*)?$' '$1\t$2' diff --git a/share/completions/xdg-mime.fish b/share/completions/xdg-mime.fish index d1eb80193..c80d2846f 100644 --- a/share/completions/xdg-mime.fish +++ b/share/completions/xdg-mime.fish @@ -15,8 +15,8 @@ complete -c xdg-mime -d 'Query default application for type' -n 'contains_seq qu complete -c xdg-mime -d 'Query file\'s filetype' -n 'contains_seq query filetype -- (commandline -cop)' -r # complete xdg-mime default -complete -c xdg-mime -d 'Choose application' -n '__fish_seen_subcommand_from default; and __fish_is_token_n 3' -xa '(__fish_print_xdg_desktop_file_ids)' -complete -c xdg-mime -d Mimetype -n '__fish_seen_subcommand_from default; and __fish_is_token_n 4' -xa '(__fish_print_xdg_mimetypes)' +complete -c xdg-mime -d 'Choose application' -n '__fish_seen_subcommand_from default; and fish_is_nth_token 3' -xa '(__fish_print_xdg_desktop_file_ids)' +complete -c xdg-mime -d Mimetype -n '__fish_seen_subcommand_from default; and fish_is_nth_token 4' -xa '(__fish_print_xdg_mimetypes)' # complete xdg-mime install complete -c xdg-mime -d 'Add filetype description' -n 'contains_seq xdg-mime install -- (commandline -cop)' -r diff --git a/share/completions/xinput.fish b/share/completions/xinput.fish index 6f8df0274..c86445c24 100644 --- a/share/completions/xinput.fish +++ b/share/completions/xinput.fish @@ -28,5 +28,5 @@ function __fish_xinput_nth_token end complete -c xinput -f -n "not __fish_seen_subcommand_from $cmds" -a "$cmds" -complete -c xinput -f -n "__fish_is_nth_token 2; and __fish_seen_subcommand_from list get-feedbacks set-pointer set-mode set-ptr-feedback set-integer-feedback set-button-map query-state list-props set-int-prop set-float-prop set-prop watch-props" -a "(__fish_xinput_devices)" -complete -c xinput -f -n "__fish_seen_subcommand_from list set-int-prop set-float-prop set-prop watch-props; and not __fish_is_nth_token 2" -xa "(__fish_xinput_device_props (__fish_xinput_nth_token 2))" +complete -c xinput -f -n "fish_is_nth_token 2; and __fish_seen_subcommand_from list get-feedbacks set-pointer set-mode set-ptr-feedback set-integer-feedback set-button-map query-state list-props set-int-prop set-float-prop set-prop watch-props" -a "(__fish_xinput_devices)" +complete -c xinput -f -n "__fish_seen_subcommand_from list set-int-prop set-float-prop set-prop watch-props; and not fish_is_nth_token 2" -xa "(__fish_xinput_device_props (__fish_xinput_nth_token 2))" diff --git a/share/completions/xsv.fish b/share/completions/xsv.fish index 49e7dbfa8..a68a3e5eb 100644 --- a/share/completions/xsv.fish +++ b/share/completions/xsv.fish @@ -1,26 +1,26 @@ -complete -c xsv -n __fish_is_first_token -xa cat -d 'Concatenate by row or column' -complete -c xsv -n __fish_is_first_token -xa count -d 'Count records' -complete -c xsv -n __fish_is_first_token -xa fixlengths -d 'Makes all records have same length' -complete -c xsv -n __fish_is_first_token -xa flatten -d 'Show one field per line' -complete -c xsv -n __fish_is_first_token -xa fmt -d 'Format CSV output (change field delimiter)' -complete -c xsv -n __fish_is_first_token -xa frequency -d 'Show frequency tables' -complete -c xsv -n __fish_is_first_token -xa headers -d 'Show header names' -complete -c xsv -n __fish_is_first_token -xa help -d 'Show this usage message.' -complete -c xsv -n __fish_is_first_token -xa index -d 'Create CSV index for faster access' -complete -c xsv -n __fish_is_first_token -xa input -d 'Read CSV data with special quoting rules' -complete -c xsv -n __fish_is_first_token -xa join -d 'Join CSV files' -complete -c xsv -n __fish_is_first_token -xa sample -d 'Randomly sample CSV data' -complete -c xsv -n __fish_is_first_token -xa search -d 'Search CSV data with regexes' -complete -c xsv -n __fish_is_first_token -xa select -d 'Select columns from CSV' -complete -c xsv -n __fish_is_first_token -xa slice -d 'Slice records from CSV' -complete -c xsv -n __fish_is_first_token -xa sort -d 'Sort CSV data' -complete -c xsv -n __fish_is_first_token -xa split -d 'Split CSV data into many files' -complete -c xsv -n __fish_is_first_token -xa stats -d 'Compute basic statistics' -complete -c xsv -n __fish_is_first_token -xa table -d 'Align CSV data into columns' +complete -c xsv -n "fish_is_nth_token 1" -xa cat -d 'Concatenate by row or column' +complete -c xsv -n "fish_is_nth_token 1" -xa count -d 'Count records' +complete -c xsv -n "fish_is_nth_token 1" -xa fixlengths -d 'Makes all records have same length' +complete -c xsv -n "fish_is_nth_token 1" -xa flatten -d 'Show one field per line' +complete -c xsv -n "fish_is_nth_token 1" -xa fmt -d 'Format CSV output (change field delimiter)' +complete -c xsv -n "fish_is_nth_token 1" -xa frequency -d 'Show frequency tables' +complete -c xsv -n "fish_is_nth_token 1" -xa headers -d 'Show header names' +complete -c xsv -n "fish_is_nth_token 1" -xa help -d 'Show this usage message.' +complete -c xsv -n "fish_is_nth_token 1" -xa index -d 'Create CSV index for faster access' +complete -c xsv -n "fish_is_nth_token 1" -xa input -d 'Read CSV data with special quoting rules' +complete -c xsv -n "fish_is_nth_token 1" -xa join -d 'Join CSV files' +complete -c xsv -n "fish_is_nth_token 1" -xa sample -d 'Randomly sample CSV data' +complete -c xsv -n "fish_is_nth_token 1" -xa search -d 'Search CSV data with regexes' +complete -c xsv -n "fish_is_nth_token 1" -xa select -d 'Select columns from CSV' +complete -c xsv -n "fish_is_nth_token 1" -xa slice -d 'Slice records from CSV' +complete -c xsv -n "fish_is_nth_token 1" -xa sort -d 'Sort CSV data' +complete -c xsv -n "fish_is_nth_token 1" -xa split -d 'Split CSV data into many files' +complete -c xsv -n "fish_is_nth_token 1" -xa stats -d 'Compute basic statistics' +complete -c xsv -n "fish_is_nth_token 1" -xa table -d 'Align CSV data into columns' # with a subcommand -complete -c xsv -n 'not __fish_is_first_token' -k -xa '(__fish_complete_suffix .csv)' -complete -c xsv -n 'not __fish_is_first_token' -s h -l help -d 'Display help for this xsv command' +complete -c xsv -n 'not fish_is_nth_token 1' -k -xa '(__fish_complete_suffix .csv)' +complete -c xsv -n 'not fish_is_nth_token 1' -s h -l help -d 'Display help for this xsv command' # without a subcommand complete -c xsv -s h -l help -d 'Display xsv help' diff --git a/share/completions/yadm.fish b/share/completions/yadm.fish index cf84fcd4c..7a6d07ce8 100644 --- a/share/completions/yadm.fish +++ b/share/completions/yadm.fish @@ -128,4 +128,4 @@ complete -f -c yadm -n "__fish_yadm_using_command config" -l unset -a '(__fish_y complete -f -c yadm -n "__fish_yadm_using_command config" -l unset-all -a '(__fish_yadm_config_keys)' -d 'Remove matching variables' # If no argument is specified for `config`, it's as if --get was used -complete -f -c yadm -n "__fish_yadm_using_command config; and __fish_is_token_n 3" -a '(__fish_yadm_config_keys)' +complete -f -c yadm -n "__fish_yadm_using_command config; and fish_is_nth_token 3" -a '(__fish_yadm_config_keys)' diff --git a/share/functions/__fish_is_first_token.fish b/share/functions/__fish_is_first_token.fish index 6fdd4030d..8f5e4b83f 100644 --- a/share/functions/__fish_is_first_token.fish +++ b/share/functions/__fish_is_first_token.fish @@ -1,15 +1,4 @@ function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet' - set -l cmd (commandline -poc) - set -e cmd[1] - for i in $cmd - switch $i - case '-*' - - case '*' - return 1 - - end - end - return 0 + fish_is_nth_token 1 end diff --git a/share/functions/__fish_is_nth_token.fish b/share/functions/__fish_is_nth_token.fish index aa256dc89..4f4464fa1 100644 --- a/share/functions/__fish_is_nth_token.fish +++ b/share/functions/__fish_is_nth_token.fish @@ -1,6 +1,3 @@ -function __fish_is_nth_token - set -l n $argv[1] - set -l tokens (commandline -poc) - set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens) - test (count $tokens) -eq "$n" +function __fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n + fish_is_nth_token $n end diff --git a/share/functions/__fish_is_token_n.fish b/share/functions/__fish_is_token_n.fish index c0c698644..a8fddce53 100644 --- a/share/functions/__fish_is_token_n.fish +++ b/share/functions/__fish_is_token_n.fish @@ -1,5 +1,5 @@ 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 + fish_is_nth_token $n end + + diff --git a/share/functions/fish_is_nth_token.fish b/share/functions/fish_is_nth_token.fish new file mode 100644 index 000000000..c3f23cf53 --- /dev/null +++ b/share/functions/fish_is_nth_token.fish @@ -0,0 +1,5 @@ +function fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n + set -l tokens (commandline -poc) + set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens) + test (count $tokens) -eq "$n" +end