mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
string completions: add missing upper, lower, split0, join0, unescape
and --style=regex
This commit is contained in:
parent
8743961301
commit
3115446a07
|
@ -2,23 +2,29 @@
|
|||
# This follows a strict command-then-options approach, so we can just test the number of tokens
|
||||
complete -f -c string
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and not contains -- (commandline -opc)[2] escape" -s q -l quiet -d "Do not print output"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "lower"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "upper"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "length"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "sub"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s s -l start -a "(seq 1 10)"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s l -l length -a "(seq 1 10)"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s s -l start -a "(seq 1 10)"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s l -l length -a "(seq 1 10)"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "split"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] split" -s m -l max -a "(seq 1 10)" -d "Specify maximum number of splits"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] split" -s r -l right -d "Split right-to-left"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "split0"
|
||||
complete -x -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s m -l max -a "(seq 1 10)" -d "Specify maximum number of splits"
|
||||
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s r -l right -d "Split right-to-left"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "join"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "join0"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "trim"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s l -l left -d "Trim only leading characters"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s r -l right -d "Trim only trailing characters"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s c -l chars -d "Specify the chars to trim (default: whitespace)"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "escape"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape" -s n -l no-quoted -d "Escape with \\ instead of quoting"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape" -l style -d "Pick escaping style" -a "
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "unescape"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -s n -l no-quoted -d "Escaped with \\ instead of quoted"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -l style -d "Escaping style" -a "
|
||||
(printf '%s\t%s\n' script 'For use in scripts' \
|
||||
var 'For use as a variable name' \
|
||||
regex 'For string match -r, string replace -r' \
|
||||
url 'For use as a URL')"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "match"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match" -s n -l index -d "Report index and length of the matches"
|
||||
|
@ -29,6 +35,6 @@ complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains --
|
|||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match replace" -s i -l ignore-case -d "Case insensitive"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match replace" -s r -l regex -d "Use regex instead of globs"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a "repeat"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s n -l count -a "(seq 1 10)" -d "Repetition count"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s m -l max -a "(seq 1 10)" -d "Maximum number of printed char"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s n -l count -a "(seq 1 10)" -d "Repetition count"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s m -l max -a "(seq 1 10)" -d "Maximum number of printed char"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s N -l no-newline -d "Remove newline"
|
||||
|
|
Loading…
Reference in New Issue
Block a user