From 8a3b5ca007e4382daa4660ebf39e4b373389d4b8 Mon Sep 17 00:00:00 2001 From: Emily Grace Seville Date: Sat, 27 Nov 2021 04:30:43 +1000 Subject: [PATCH] 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 --- share/completions/findstr.fish | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 share/completions/findstr.fish diff --git a/share/completions/findstr.fish b/share/completions/findstr.fish new file mode 100644 index 000000000..47892995a --- /dev/null +++ b/share/completions/findstr.fish @@ -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)'