diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b210bd15a..a5cb7fb14 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 diff --git a/po/de.po b/po/de.po index 45a8bb607..0e0e736cf 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_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 "" diff --git a/po/en.po b/po/en.po index 6ada1dd44..c2f61173a 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_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" diff --git a/po/fr.po b/po/fr.po index 4841f42f6..37dd038b7 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_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 "" diff --git a/po/pl.po b/po/pl.po index 599d45115..3ed209305 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_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 "" diff --git a/po/pt_BR.po b/po/pt_BR.po index a7bb47975..4f5fd2d87 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_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 "" diff --git a/po/sv.po b/po/sv.po index d74a60035..7d7d67a97 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_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 "" diff --git a/po/zh_CN.po b/po/zh_CN.po index df0a02dd5..8109f8c89 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_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 "" diff --git a/share/completions/aws.fish b/share/completions/aws.fish index f14013d35..c63f831d1 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_nth_token 1" -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 b0dfa841f..d3a95ef8c 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_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 ]' +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 0bc9ea412..0fa768d4f 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -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 diff --git a/share/completions/meson.fish b/share/completions/meson.fish index abce460d2..9a3fe94de 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_nth_token 1" -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 d0d0fbb1a..f97f1fd14 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_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 diff --git a/share/completions/python2.fish b/share/completions/python2.fish index d4047915b..bdfc25bc2 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_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" diff --git a/share/completions/python3.fish b/share/completions/python3.fish index 5b4447df5..27664ff45 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_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`' diff --git a/share/completions/rustup.fish b/share/completions/rustup.fish index 66ae416fe..5653350a1 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_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" diff --git a/share/completions/s3cmd.fish b/share/completions/s3cmd.fish index 5283ed9cb..3c316725b 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_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' diff --git a/share/completions/service.fish b/share/completions/service.fish index 0a8ccec5c..b043388f1 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_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 diff --git a/share/completions/set.fish b/share/completions/set.fish index a88fffe28..f7b24800f 100644 --- a/share/completions/set.fish +++ b/share/completions/set.fish @@ -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:\ )" diff --git a/share/completions/ttx.fish b/share/completions/ttx.fish index 85a709992..1c52ef373 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_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' diff --git a/share/completions/udevadm.fish b/share/completions/udevadm.fish index 15449a425..1253c6101 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_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'" diff --git a/share/completions/unzip.fish b/share/completions/unzip.fish index fe513b87c..080ed29f8 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_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 diff --git a/share/completions/vips.fish b/share/completions/vips.fish index da22df748..58d8e0dea 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_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' diff --git a/share/completions/xdg-mime.fish b/share/completions/xdg-mime.fish index c80d2846f..6e1f1f3db 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_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 diff --git a/share/completions/xinput.fish b/share/completions/xinput.fish index c86445c24..6f8df0274 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 a68a3e5eb..edb28fd54 100644 --- a/share/completions/xsv.fish +++ b/share/completions/xsv.fish @@ -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' diff --git a/share/completions/yadm.fish b/share/completions/yadm.fish index 7a6d07ce8..1f7e2dc79 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_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)' diff --git a/share/completions/zpool.fish b/share/completions/zpool.fish index 86f630daa..f20fa3972 100644 --- a/share/completions/zpool.fish +++ b/share/completions/zpool.fish @@ -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 [should list only devices already part of pool] # - zpool attach [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 diff --git a/share/functions/__fish_is_first_token.fish b/share/functions/__fish_is_first_token.fish index 8f5e4b83f..9e11e3829 100644 --- a/share/functions/__fish_is_first_token.fish +++ b/share/functions/__fish_is_first_token.fish @@ -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 diff --git a/share/functions/__fish_is_nth_token.fish b/share/functions/__fish_is_nth_token.fish index 4f4464fa1..2f3a535e2 100644 --- a/share/functions/__fish_is_nth_token.fish +++ b/share/functions/__fish_is_nth_token.fish @@ -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 diff --git a/share/functions/__fish_is_token_n.fish b/share/functions/__fish_is_token_n.fish index 7e3deb51d..5dbcdfda7 100644 --- a/share/functions/__fish_is_token_n.fish +++ b/share/functions/__fish_is_token_n.fish @@ -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 diff --git a/share/functions/fish_nth_token.fish b/share/functions/__fish_nth_token.fish similarity index 68% rename from share/functions/fish_nth_token.fish rename to share/functions/__fish_nth_token.fish index 7df863ae6..597bb15ee 100644 --- a/share/functions/fish_nth_token.fish +++ b/share/functions/__fish_nth_token.fish @@ -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) diff --git a/share/functions/fish_is_nth_token.fish b/share/functions/fish_is_nth_token.fish deleted file mode 100644 index 907caae71..000000000 --- a/share/functions/fish_is_nth_token.fish +++ /dev/null @@ -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