Make __fish_is_nth_token and __fish_nth_token private again

Their names are not perfect, so let's keep them as internal functions,
until we figure out how/if we want to expose this.

This reverts 0445126c2 (Undunder __fish_is_nth_token, 2021-06-29) (but I
did it without "git revert").

Closes #8008
This commit is contained in:
Johannes Altmanninger 2022-02-09 09:46:07 +01:00
parent a7102f179b
commit 47b0d0c293
36 changed files with 171 additions and 175 deletions

View file

@ -180,7 +180,6 @@ Completions
- Many adjustments to complete correct options for system utilities on BSD and macOS.
- Unified the OpenZFS-related completions across operating systems and improved the vdev-related completions for all platforms.
- Add missing completions for the ``-p`` option of ``xbps-query``.
- The ``fish_is_nth_token`` and accompanying ``fish_nth_token`` functions, which are particularly useful in completions for identifying the token number within the command line and replace various internal functions to do the same (:issue:`8008`).
- When evaluating custom completions, the command line state no longer includes variable overrides (``var=val``). This unbreaks completions that read ``commandline -op``.
Improved terminal support

View file

@ -62163,7 +62163,7 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1
#: /tmp/fish/implicit/share/functions/__fish_is_nth_token.fish:1
msgid "Test if current token is on Nth place"
msgstr ""

View file

@ -62165,7 +62165,7 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.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"

View file

@ -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_nth_token.fish:1
#: /tmp/fish/implicit/share/functions/__fish_is_nth_token.fish:1
msgid "Test if current token is on Nth place"
msgstr ""

View file

@ -61940,7 +61940,7 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1
#: /tmp/fish/implicit/share/functions/__fish_is_nth_token.fish:1
msgid "Test if current token is on Nth place"
msgstr ""

View file

@ -87073,7 +87073,7 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1
#: /tmp/fish/implicit/share/functions/__fish_is_nth_token.fish:1
msgid "Test if current token is on Nth place"
msgstr ""

View file

@ -57723,8 +57723,8 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1
#: share/functions/fish_is_nth_token.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 ""

View file

@ -61916,7 +61916,7 @@ msgstr ""
msgid "Check if the current directory is a git repository"
msgstr ""
#: /tmp/fish/implicit/share/functions/fish_is_nth_token.fish:1
#: /tmp/fish/implicit/share/functions/__fish_is_nth_token.fish:1
msgid "Test if current token is on Nth place"
msgstr ""

View file

@ -270,4 +270,4 @@ set -l aws_services \
workspaces \
xray
complete -c aws -n "fish_is_nth_token 1" -xa "$aws_services"
complete -c aws -n "__fish_is_nth_token 1" -xa "$aws_services"

View file

@ -64,7 +64,7 @@ for k,v in data["dependencies"].items(): print(k + "\t" + v[:18])' <bower.json 2
jq -r '.dependencies | to_entries[] | .key' bower.json
end
complete -c bower -n "fish_is_nth_token 1" -x -a '(__bower_cmds)'
complete -c bower -n "__fish_is_nth_token 1" -x -a '(__bower_cmds)'
complete -c bower -n __fish_should_complete_switches -x -a '(__bower_args)'
complete -c bower -n "__fish_seen_subcommand_from install" -x -a '(__bower_matching_pkgs)'
complete -c bower -n "__fish_seen_subcommand_from uninstall" -x -a '(__bower_list_installed)'

View file

@ -2,4 +2,4 @@
set -l commands aam apm attrib cmd debug defects devlist eject epc format fwdownload help hpa identify idle inquiry load modepage negotiate opcodes periphlist persist readcap reportluns reprobe rescan reset sanitize security sleep smpcmd smpmaninfo smppc smpphylist smprg standby start stop tags timestamp tur zone
complete -c camcontrol -n "fish_is_nth_token 1" -xa "$commands"
complete -c camcontrol -n "__fish_is_nth_token 1" -xa "$commands"

View file

@ -5,28 +5,28 @@ complete -c cygport -s 8 -l 64 -d "Build for 64-bit Cygwin"
complete -c cygport -l debug -d "Enable debugging messages"
# Cygport file
complete -c cygport -n "fish_is_nth_token 1" -f -a '*.cygport' -d "Cygport file"
complete -c cygport -n "__fish_is_nth_token 1" -f -a '*.cygport' -d "Cygport file"
# Commands
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'downloadall fetchall wgetall getall' -d "Download all sources"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'download fetch wget get' -d "Download missing sources"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'prep unpack' -d "Prepare source directory"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'compile build make' -d "Build software"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'check test' -d "Run test suite"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'inst install' -d "Install into DESTDIR and run post-installation steps"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a postinst -d "Run post-installation steps"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a list -d "List package files"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'listdebug listdbg' -d "List debug package files"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a dep -d "Show dependencies"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a info -d "Show packaging info"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'homepage web www' -d "Show project homepage URL"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'package-test pkg-test' -d "Create packages, marked as test"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'package pkg' -d "Create packages"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'diff mkdiff mkpatch' -d "Create source patches"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'upload up' -d "Upload finished packages"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a stage -d "Upload packages without marking !ready"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a announce -d "Send announcement email"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'clean finish' -d "Delete working directory"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a 'almostall all' -d "Same as prep build inst pkg"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a help -d "Show help"
complete -c cygport -n 'not fish_is_nth_token 1' -f -a version -d "Show version"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'downloadall fetchall wgetall getall' -d "Download all sources"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'download fetch wget get' -d "Download missing sources"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'prep unpack' -d "Prepare source directory"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'compile build make' -d "Build software"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'check test' -d "Run test suite"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'inst install' -d "Install into DESTDIR and run post-installation steps"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a postinst -d "Run post-installation steps"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a list -d "List package files"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'listdebug listdbg' -d "List debug package files"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a dep -d "Show dependencies"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a info -d "Show packaging info"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'homepage web www' -d "Show project homepage URL"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'package-test pkg-test' -d "Create packages, marked as test"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'package pkg' -d "Create packages"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'diff mkdiff mkpatch' -d "Create source patches"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'upload up' -d "Upload finished packages"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a stage -d "Upload packages without marking !ready"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a announce -d "Send announcement email"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'clean finish' -d "Delete working directory"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a 'almostall all' -d "Same as prep build inst pkg"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a help -d "Show help"
complete -c cygport -n 'not __fish_is_nth_token 1' -f -a version -d "Show version"

View file

@ -1,24 +1,24 @@
# First parameter is the profile name, or 'usage'
complete -c duply -f -n "fish_is_nth_token 1" -a '(set -l files /etc/duply/* ~/.duply/*; string replace -r ".*/" "" -- $files)' -d Profile
complete -c duply -f -n "__fish_is_nth_token 1" -a '(set -l files /etc/duply/* ~/.duply/*; string replace -r ".*/" "" -- $files)' -d Profile
complete --command duply --no-files --arguments usage -d 'Get usage help text'
# Second parameter is a duply command
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 <profile>/pre script'
complete --command duply --no-files --condition 'not fish_is_nth_token 1' --arguments post -d 'Execute <profile>/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 <age>, 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 <target_path> [as it was at <age>]'
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 <age>]'
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 <profile>/pre script'
complete --command duply --no-files --condition 'not __fish_is_nth_token 1' --arguments post -d 'Execute <profile>/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 <age>, 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 <target_path> [as it was at <age>]'
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 <age>]'
# Options
complete --command duply --no-files --long-option force -d 'Really execute the commands: purge, purge-full, cleanup'

View file

@ -2104,7 +2104,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 values are shown first
complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 2' -kfa '(__fish_git_config_keys)'
complete -c git -n '__fish_git_using_command config; and __fish_is_nth_token 2' -kfa '(__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)'
complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value specific for the section url' -r

View file

@ -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_nth_token 1" -xa '(__fish_complete_directories)'
complete -c meson -n "__fish_is_nth_token 1" -xa '(__fish_complete_directories)'

View file

@ -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_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'
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

View file

@ -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_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 -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"

View file

@ -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_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 -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`'

View file

@ -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_nth_token 1" -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"

View file

@ -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_nth_token 1" -f
complete -c s3cmd -n "__fish_is_nth_token 1" -f
# Available commands
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'
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'

View file

@ -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_nth_token 1" -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_nth_token 1' -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_nth_token 1' -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_nth_token 1' -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_nth_token 1' -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

View file

@ -71,37 +71,37 @@ end
#
# Regular switches, set only accepts these before the variable name,
# so we need to test using "fish_is_nth_token 1"
# so we need to test using "__fish_is_nth_token 1"
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 f -l function -d "Make variable function-scoped"
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 L -l long -d 'Do not truncate long lines'
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"
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 f -l function -d "Make variable function-scoped"
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 L -l long -d 'Do not truncate long lines'
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_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 -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_nth_token 1; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_complete_special_vars)"
complete -c set -n '__fish_is_nth_token 1; and not __fish_seen_argument -s e -l erase' -x -a "(__fish_complete_special_vars)"
# Complete scope-specific variables
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 -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:\ )"

View file

@ -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_nth_token 1" -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'

View file

@ -1,5 +1,5 @@
set -l commands info trigger settle control monitor test test-builtin
complete -c udevadm -n "fish_is_nth_token 1" -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'"

View file

@ -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_nth_token 1" -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_nth_token 1' -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

View file

@ -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_nth_token 1" -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'

View file

@ -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_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 -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

View file

@ -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))"

View file

@ -1,26 +1,26 @@
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'
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_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'
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'

View file

@ -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_nth_token 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)'

View file

@ -234,7 +234,7 @@ complete -c zpool -x -n '__fish_zpool_using_command add; and __fish_is_nth_token
# complete -c zpool -x -n '__fish_zpool_using_command add; and not __fish_prev_arg_in add' -d 'Virtual device to add' -a '(__fish_zpool_complete_vdevs)'
# Exclude devices already part of this pool, and devices already in any other pool unless
# `zpool add -f` was used.
complete -c zpool -x -n '__fish_zpool_using_command add; and not __fish_prev_arg_in add' -k -d 'Virtual device to add' -a '(__fish_zpool_complete_vdevs | string match -vr (__fish_zpool_list_used_vdevs (__fish_seen_argument -s f && fish_nth_token 2) | string escape --style regex | string replace -r \'(.*)\' \'^$1\\\\\\$\' | string join "|"))' # the insane number of backslashes is unfortunate
complete -c zpool -x -n '__fish_zpool_using_command add; and not __fish_prev_arg_in add' -k -d 'Virtual device to add' -a '(__fish_zpool_complete_vdevs | string match -vr (__fish_zpool_list_used_vdevs (__fish_seen_argument -s f && __fish_nth_token 2) | string escape --style regex | string replace -r \'(.*)\' \'^$1\\\\\\$\' | string join "|"))' # the insane number of backslashes is unfortunate
# attach completions
complete -c zpool -f -n '__fish_zpool_using_command attach' -s f -d 'Force use of virtual device'
@ -246,12 +246,12 @@ end
# - zpool attach <tank> [should list only devices already part of pool]
# - zpool attach <tank> <da1> [should list only devices not already part of a/the pool]
complete -c zpool -x -n '__fish_zpool_using_command attach; and __fish_is_nth_token 2' -d 'Pool to attach virtual device to' -a '(__fish_complete_zfs_pools)'
complete -c zpool -x -n '__fish_zpool_using_command attach; and __fish_is_nth_token 3' -d 'Existing pool device to attach to' -a '(__fish_zpool_list_used_vdevs (fish_nth_token 2))'
complete -c zpool -x -n '__fish_zpool_using_command attach; and __fish_is_nth_token 3' -d 'Existing pool device to attach to' -a '(__fish_zpool_list_used_vdevs (__fish_nth_token 2))'
# Generate a list of devices in the system modulo devices already part of an online zpool.
# These latter can be forcefully added, so we only exclude them if we don't introspect the presence
# of a `-f` argument to `zpool attach` (but still exclude any devices already part of the same pool
# that we're attaching to, "obviously").
complete -c zpool -x -n '__fish_zpool_using_command attach; and __fish_is_nth_token 4' -d 'Device to be attached' -a '(__fish_zpool_list_available_vdevs | string match -vr (__fish_zpool_list_used_vdevs (__fish_seen_argument -s f && fish_nth_token 2) | string escape --style regex | string replace -r \'(.*)\' \'^$1\\\\\\$\' | string join "|"))' # the insane number of backslashes is unfortunate
complete -c zpool -x -n '__fish_zpool_using_command attach; and __fish_is_nth_token 4' -d 'Device to be attached' -a '(__fish_zpool_list_available_vdevs | string match -vr (__fish_zpool_list_used_vdevs (__fish_seen_argument -s f && __fish_nth_token 2) | string escape --style regex | string replace -r \'(.*)\' \'^$1\\\\\\$\' | string join "|"))' # the insane number of backslashes is unfortunate
# clear completions
if test $OS = FreeBSD

View file

@ -1,4 +1,4 @@
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
fish_is_nth_token 1
__fish_is_nth_token 1
end

View file

@ -1,3 +1,5 @@
function __fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
fish_is_nth_token $n
function __fish_is_nth_token --description 'Test if current token is the Nth (ignoring command and switches/flags)' --argument-names n
set -l tokens (commandline -poc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
test (count $tokens) -eq "$n"
end

View file

@ -1,3 +1,3 @@
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument-names n
fish_is_nth_token $n
__fish_is_nth_token $n
end

View file

@ -1,4 +1,4 @@
function fish_nth_token --description 'Prints the Nth token (ignoring command and switches/flags)' --argument-names n
function __fish_nth_token --description 'Prints the Nth token (ignoring command and switches/flags)' --argument-names n
set -l tokens (commandline -po | string replace -r --filter '^([^-].*)' '$1')
# Increment $n by one to account for ignoring the command
if test (count $tokens) -ge (math "$n" + 1)

View file

@ -1,5 +0,0 @@
function fish_is_nth_token --description 'Test if current token is the Nth (ignoring command and switches/flags)' --argument-names n
set -l tokens (commandline -poc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
test (count $tokens) -eq "$n"
end