mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 07:28:03 +08:00
Add findstr completion (#8481)
* Add findstr completion * Standardize completion * Show completion only on Windows * Use single quotes where possible * Remove quotes where possible * Remove OS check * Use single quotes for --arguments
This commit is contained in:
parent
0697e09f14
commit
8a3b5ca007
45
share/completions/findstr.fish
Normal file
45
share/completions/findstr.fish
Normal file
|
@ -0,0 +1,45 @@
|
|||
function __findstr_generate_args --description 'Function to generate args'
|
||||
set --local current_token (commandline --current-token --cut-at-cursor)
|
||||
switch $current_token
|
||||
case '/a:*'
|
||||
echo -e '0\tBlack
|
||||
1\tBlue
|
||||
2\tGreen
|
||||
3\tAqua
|
||||
4\tRed
|
||||
5\tPurple
|
||||
6\tYellow
|
||||
7\tWhite
|
||||
8\tGray
|
||||
9\tLight blue
|
||||
A\tLight green
|
||||
B\tLight aqua
|
||||
C\tLight red
|
||||
D\tLight purple
|
||||
E\tLight yellow
|
||||
F\tBright white' | awk -F '\t' "{ printf \"$current_token%s\t%s\n\", \$1, \$2 }"
|
||||
case '*'
|
||||
echo -e '/b\tMatch at the beginning of the line
|
||||
/e\tMatch at the end of the line
|
||||
/l\tUse literal strings
|
||||
/r\tUse regular expressions
|
||||
/s\tSearch a current directory and all subdirectories
|
||||
/i\tIgnore case
|
||||
/x\tMatch exactly
|
||||
/v\tInvert match
|
||||
/n\tPrint line numbers
|
||||
/m\tPrint only the file name with matching lines
|
||||
/o\tPrint character offset
|
||||
/p\tSkip files with non-printable characters
|
||||
/off\tDon\'t skip files that have the offline attribute set
|
||||
/offline\tDon\'t skip files that have the offline attribute set
|
||||
/f:\tRead a file list from file
|
||||
/c:\tSpecify a literal search string
|
||||
/g:\tRead literal search strings from file
|
||||
/d:\tSpecify the search list of directories
|
||||
/a:\tUse color attributes with two hexadecimal digits
|
||||
/?\tShow help'
|
||||
end
|
||||
end
|
||||
|
||||
complete --command findstr --no-files --arguments '(__findstr_generate_args)'
|
Loading…
Reference in New Issue
Block a user