mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Fix stale name of --tokens-expand option
Missed in 368017905
(builtin commandline: -x for expanded tokens, supplanting
-o, 2024-01-06).
This commit is contained in:
parent
1deb065f59
commit
33a9659cd1
7 changed files with 8 additions and 8 deletions
|
@ -74,9 +74,9 @@ The following options change the way ``commandline`` prints the current commandl
|
||||||
|
|
||||||
**-c** or **--cut-at-cursor**
|
**-c** or **--cut-at-cursor**
|
||||||
Only print selection up until the current cursor position.
|
Only print selection up until the current cursor position.
|
||||||
If combined with ``--expand-tokens``, this will print up until the last completed token - excluding the token the cursor is in.
|
If combined with ``--tokens-expanded``, this will print up until the last completed token - excluding the token the cursor is in.
|
||||||
This is typically what you would want for instance in completions.
|
This is typically what you would want for instance in completions.
|
||||||
To get both, use both ``commandline --cut-at-cursor --expand-tokens; commandline --cut-at-cursor --current-token``,
|
To get both, use both ``commandline --cut-at-cursor --tokens-expanded; commandline --cut-at-cursor --current-token``,
|
||||||
or ``commandline -cx; commandline -ct`` for short.
|
or ``commandline -cx; commandline -ct`` for short.
|
||||||
|
|
||||||
**-x** or **tokens-expanded**
|
**-x** or **tokens-expanded**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_argparse_exclusive_args --description 'Helper function to list unused options'
|
function __fish_argparse_exclusive_args --description 'Helper function to list unused options'
|
||||||
set --local all_tokens (commandline --expand-tokens)
|
set --local all_tokens (commandline --tokens-expanded)
|
||||||
set --erase all_tokens[1]
|
set --erase all_tokens[1]
|
||||||
set --local current_token (commandline --current-token)
|
set --local current_token (commandline --current-token)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ function __history_completions --argument-names limit
|
||||||
set limit 25
|
set limit 25
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l tokens (commandline --current-process --expand-tokens)
|
set -l tokens (commandline --current-process --tokens-expanded)
|
||||||
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | head -n$limit
|
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | head -n$limit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_lxc_no_subcommand -d 'Test if lxc has yet to be given the command'
|
function __fish_lxc_no_subcommand -d 'Test if lxc has yet to be given the command'
|
||||||
for i in (commandline --expand-tokens --cut-at-cursor --current-process)
|
for i in (commandline --tokens-expanded --cut-at-cursor --current-process)
|
||||||
if contains -- $i config console copy delete exec file help image info launch list move network pause profile publish remote rename restart restore shell snapshot start stop
|
if contains -- $i config console copy delete exec file help image info launch list move network pause profile publish remote rename restart restore shell snapshot start stop
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_qdbus_complete
|
function __fish_qdbus_complete
|
||||||
argparse system 'bus=' literal help -- (commandline --cut-at-cursor --expand-tokens) 2>/dev/null
|
argparse system 'bus=' literal help -- (commandline --cut-at-cursor --tokens-expanded) 2>/dev/null
|
||||||
or return
|
or return
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,7 +17,7 @@ function __fish_complete_freebsd_service_actions
|
||||||
# Use the output of `service -v foo` to retrieve the list of service-specific verbs
|
# Use the output of `service -v foo` to retrieve the list of service-specific verbs
|
||||||
# Output takes the form "[prefix1 prefix2 ..](cmd1 cmd2 cmd3)" where any combination
|
# Output takes the form "[prefix1 prefix2 ..](cmd1 cmd2 cmd3)" where any combination
|
||||||
# of zero or one prefixe(s) and any one command is a valid verb.
|
# of zero or one prefixe(s) and any one command is a valid verb.
|
||||||
set -l service_name (commandline --expand-tokens --cut-at-cursor)[-1]
|
set -l service_name (commandline --tokens-expanded --cut-at-cursor)[-1]
|
||||||
set -l results (service $service_name -v 2>| string match -r '\\[(.*)\\]\\((.*)\\)')
|
set -l results (service $service_name -v 2>| string match -r '\\[(.*)\\]\\((.*)\\)')
|
||||||
set -l prefixes "" (string split '|' -- $results[2])
|
set -l prefixes "" (string split '|' -- $results[2])
|
||||||
set -l commands (string split '|' -- $results[3])
|
set -l commands (string split '|' -- $results[3])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function __fish_seen_argument --description 'Check whether argument is used'
|
function __fish_seen_argument --description 'Check whether argument is used'
|
||||||
argparse --ignore-unknown 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
argparse --ignore-unknown 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
||||||
|
|
||||||
set --local tokens (commandline --current-process --expand-tokens --cut-at-cursor)
|
set --local tokens (commandline --current-process --tokens-expanded --cut-at-cursor)
|
||||||
set --erase tokens[1]
|
set --erase tokens[1]
|
||||||
|
|
||||||
for t in $tokens
|
for t in $tokens
|
||||||
|
|
Loading…
Reference in a new issue