-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathug.sh
189 lines (182 loc) · 17.1 KB
/
ug.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env bash
# Automatic generated, DON'T MODIFY IT.
# @option -A --after-context <NUM> Output NUM lines of trailing context after matching lines.
# @flag -a --text Process a binary file as if it were text.
# @flag -@ --all Search all files except hidden: cancel previous file and directory search restrictions and cancel --ignore-binary and --ignore-files when specified.
# @flag --and Specify additional PATTERN that must match.
# @flag --andnot Combines --and --not.
# @option -B --before-context <NUM> Output NUM lines of leading context before matching lines.
# @flag -b --byte-offset The offset in bytes of a pattern match is displayed in front of the respective matched line.
# @option --binary-files <TYPE> Controls searching and reporting pattern matches in binary files.
# @flag -% --bool Specifies Boolean query patterns.
# @flag --break Adds a line break between results from different files.
# @option -C --context <NUM> Output NUM lines of leading and trailing context surrounding each matching line.
# @flag -c --count Only a count of selected lines is written to standard output.
# @option --color[`_choice_color`] <WHEN> Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable.
# @option --colour[`_choice_color`] <WHEN> Mark up the matching text with the colors specified with option --colors or the GREP_COLOR or GREP_COLORS environment variable.
# @option --colors <COLORS> Use COLORS to mark up text.
# @option --colours <COLORS> Use COLORS to mark up text.
# @option --config <FILE> Use configuration FILE.
# @option --- <FILE> Use configuration FILE.
# @flag --no-config Do not automatically load the default .ugrep configuration file.
# @flag --no-confirm Do not confirm actions in -Q query TUI.
# @flag --cpp Output file matches in C++.
# @flag --csv Output file matches in CSV.
# @option -D --devices <ACTION> If an input file is a device, FIFO or socket, use ACTION to process it.
# @option -d --directories <ACTION> If an input file is a directory, use ACTION to process it.
# @option --delay Set the default -Q key response delay.
# @option --depth <[MIN,][MAX]> Restrict recursive searches from MIN to MAX directory levels deep, where -1 (--depth=1) searches the specified path without recursing into subdirectories.
# @flag --dotall Dot `.' in regular expressions matches anything, including newline.
# @flag -E --extended-regexp Interpret patterns as extended regular expressions (EREs).
# @option -e --regexp <PATTERN> Specify a PATTERN to search the input.
# @option --encoding[`_choice_encoding`] The encoding format of the input.
# @option --exclude <GLOB> Exclude files whose name matches GLOB, same as -g ^GLOB.
# @option --exclude-dir <GLOB> Exclude directories whose name matches GLOB from recursive searches, same as -g ^GLOB/.
# @option --exclude-from <FILE> Read the globs from FILE and skip files and directories whose name matches one or more globs.
# @option --exclude-fs <MOUNTS> Exclude file systems specified by MOUNTS from recursive searches.
# @flag -F --fixed-strings Interpret pattern as a set of fixed strings, separated by newlines, any of which is to be matched.
# @option -f --file Read newline-separated patterns from FILE.
# @option --filter <COMMANDS> Filter files through the specified COMMANDS first before searching.
# @option --filter-magic-label <[+]LABEL:MAGIC> Associate LABEL with files whose signature "magic bytes" match the MAGIC regex pattern.
# @option --format Output FORMAT-formatted matches.
# @flag --free-space Spacing (blanks and tabs) in regular expressions are ignored.
# @flag -G --basic-regexp Interpret patterns as basic regular expressions (BREs).
# @option -g <GLOBS> Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each `glob' in GLOBS.
# @option --glob <GLOBS> Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each `glob' in GLOBS.
# @option --iglob <GLOBS> Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each `glob' in GLOBS.
# @flag --glob-ignore-case Perform case-insensitive glob matching in general.
# @option --group-separator <SEP> Use SEP as a group separator for context options -A, -B and -C.
# @flag --no-group-separator Removes the group separator line from the output for context options -A, -B and -C.
# @flag -H --with-filename Always print the filename with output lines.
# @flag -h --no-filename Never print filenames with output lines.
# @flag -+ --heading Group matches per file.
# @option -? --help <WHAT> Display a help message on options related to WHAT when specified.
# @option --hexdump <[1-8][a][bch][A[NUM]][B[NUM]][C[NUM]]> Output matches in 1 to 8 columns of 8 hexadecimal octets.
# @flag -. --hidden Search hidden files and directories.
# @option --hyperlink <[PREFIX][+]> Hyperlinks are enabled for file names when colors are enabled.
# @flag -I --ignore-binary Ignore matches in binary files.
# @flag -i --ignore-case Perform case insensitive matching.
# @option --ignore-files <FILE> Ignore files and directories matching the globs in each FILE that is encountered in recursive searches.
# @flag --no-ignore-files Do not ignore files, i.e.
# @option --include <GLOB> Only search files whose name matches GLOB, same as -g GLOB.
# @option --include-dir <GLOB> Only directories whose name matches GLOB are included in recursive searches, same as -g GLOB/.
# @option --include-from <FILE> Read the globs from FILE and search only files and directories whose name matches one or more globs.
# @option --include-fs <MOUNTS> Only file systems specified by MOUNTS are included in recursive searches.
# @flag --index Perform fast index-based recursive search.
# @option -J --jobs <NUM> Specifies the number of threads spawned to search files.
# @flag -j --smart-case Perform case insensitive matching, unless a pattern is specified with a literal upper case ASCII letter.
# @flag --json Output file matches in JSON.
# @option -K <MAX> Start searching at line MIN, stop at line MAX when specified.
# @option --range <MAX> Start searching at line MIN, stop at line MAX when specified.
# @option --min-line <MAX> Start searching at line MIN, stop at line MAX when specified.
# @option --max-line <MAX> Start searching at line MIN, stop at line MAX when specified.
# @flag -k --column-number The column number of a pattern match is displayed in front of the respective matched line, starting at column 1.
# @flag -L --files-without-match Only the names of files not containing selected lines are written to standard output.
# @flag -l --files-with-matches Only the names of files containing selected lines are written to standard output.
# @option --label Displays the LABEL value when input is read from standard input where a file name would normally be printed in the output.
# @flag --line-buffered Force output to be line buffered instead of block buffered.
# @flag --lines Boolean line matching mode for option --bool, the default mode.
# @option -M --file-magic <MAGIC> Only search files matching the magic signature pattern MAGIC.
# @option -m <MAX> Require MIN matches, stop after MAX matches when specified.
# @option --min-count <MAX> Require MIN matches, stop after MAX matches when specified.
# @option --max-count <MAX> Require MIN matches, stop after MAX matches when specified.
# @flag --match Match all input.
# @option --max-files <NUM> Restrict the number of files matched to NUM.
# @option --mmap <MAX> Use memory maps to search files.
# @option -N --neg-regexp <PATTERN> Specify a negative PATTERN to reject specific -e PATTERN matches with a counter pattern.
# @flag -n --line-number Each output line is preceded by its relative line number in the file, starting at line 1.
# @option --not <-e> <PATTERN> Specifies that PATTERN should not match.
# @option -O --file-extension <EXTENSIONS> Only search files whose filename extensions match the specified comma-separated list of EXTENSIONS, same as -g '*.ext' for each `ext' in EXTENSIONS.
# @flag -o --only-matching Only the matching part of a pattern match is output.
# @flag --only-line-number Only the line number of a matching line is output.
# @flag --files Boolean file matching mode, the opposite of --lines.
# @flag -P --perl-regexp Interpret PATTERN as a Perl regular expression using PCRE2.
# @flag -p --no-dereference If -R or -r is specified, do not follow symbolic links, even when symbolic links are specified on the command line.
# @option --pager <COMMAND> When output is sent to the terminal, uses COMMAND to page through the output.
# @option --pretty <WHEN> When output is sent to a terminal, enables --color, --heading, -n, --sort, --tree and -T when not explicitly disabled.
# @option -Q --query <DELAY> Query mode: start a TUI to perform interactive searches.
# @flag -q Quiet mode: suppress all output.
# @flag --quiet Quiet mode: suppress all output.
# @flag --silent Quiet mode: suppress all output.
# @flag -R --dereference-recursive Recursively read all files under each directory, following symbolic links to files and directories, unlike -r.
# @flag -r --recursive Recursively read all files under each directory, following symbolic links only if they are on the command line.
# @option --replace <FORMAT> Replace matching patterns in the output by FORMAT with `%' fields.
# @flag -S --dereference-files When -r is specified, follow symbolic links to files, but not to directories.
# @flag -s --no-messages Silent mode: nonexistent and unreadable files are ignored and their error messages and warnings are suppressed.
# @option --save-config <FILE> <OPTIONS> Save configuration FILE to include OPTIONS.
# @option --separator <SEP> Use SEP as field separator between file name, line number, column number, byte offset and the matched line.
# @flag --split Split the -Q query TUI screen on startup.
# @option --sort <KEY> Displays matching files in the order specified by KEY in recursive searches.
# @flag --stats Output statistics on the number of files and directories searched and the inclusion and exclusion constraints applied.
# @flag -T --initial-tab Add a tab space to separate the file name, line number, column number and byte offset with the matched line.
# @option -t --file-type[`_choice_type`] <TYPES> Search only files associated with TYPES, a comma-separated list of file types.
# @option --tabs <NUM> Set the tab size to NUM to expand tabs for option -k.
# @option --tag <TAG[,END]> Disables colors to mark up matches with TAG.
# @flag -^ --tree Output directories with matching files in a tree-like format for option -c or --count, -l or --files-with-matches, -L or --files-without-match.
# @flag -U Disables Unicode matching for ASCII and binary matching.
# @flag --ascii Disables Unicode matching for ASCII and binary matching.
# @flag --binary Disables Unicode matching for ASCII and binary matching.
# @flag -u --ungroup Do not group multiple pattern matches on the same matched line.
# @flag -V --version Display version with linked libraries and exit.
# @flag -v --invert-match Selected lines are those not matching any of the specified patterns.
# @option --view <COMMAND> Use COMMAND to view/edit a file in -Q query TUI by pressing CTRL-Y.
# @flag -W --with-hex Output binary matches in hexadecimal, leaving text matches alone.
# @flag -w --word-regexp The PATTERN is searched for as a word, such that the matching text is preceded by a non-word character and is followed by a non-word character.
# @option --width <NUM> Truncate the output to NUM visible characters per line.
# @flag -X --hex Output matches in hexadecimal.
# @flag -x --line-regexp Select only those matches that exactly match the whole line, as if the patterns are surrounded by ^ and $.
# @flag --xml Output file matches in XML.
# @flag -Y --empty Permits empty matches.
# @flag -y Any line is output (passthru).
# @flag --any-line Any line is output (passthru).
# @flag --passthru Any line is output (passthru).
# @option -Z --fuzzy <[best][+-~][MAX]> Fuzzy mode: report approximate pattern matches within MAX errors.
# @flag -z --decompress Search compressed files and archives.
# @option --zmax <NUM> When used with option -z (--decompress), searches the contents of compressed files and archives stored within archives by up to NUM expansion stages.
# @flag -0 --null Output a zero-byte (NUL) after the file name.
# @arg pattern[`_choice_pattern`]
# @arg file*
. "$ARGC_COMPLETIONS_ROOT/utils/_argc_utils.sh"
_choice_color() {
printf "%s\n" auto never always
}
_choice_encoding() {
printf "%s\n" \
binary ASCII UTF-8 UTF-16 \
UTF-16BE UTF-16LE UTF-32 UTF-32BE \
UTF-32LE LATIN1 ISO-8859-1 ISO-8859-2 \
ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6 \
ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 \
ISO-8859-11 ISO-8859-13 ISO-8859-14 ISO-8859-15 \
ISO-8859-16 MAC MACROMAN EBCDIC \
CP437 CP850 CP858 CP1250 \
CP1251 CP1252 CP1253 CP1254 \
CP1255 CP1256 CP1257 CP1258 \
KOI8-R KOI8-U KOI8-RU
}
_choice_type() {
printf "%s\n" \
actionscript ada asm asp aspx autoconf automake \
awk Awk basic batch bison c c++ \
clojure cpp csharp css csv dart Dart \
delphi elisp elixir erlang fortran gif Gif \
go groovy gsp haskell html jade java \
jpeg Jpeg js json jsp julia kotlin \
less lex lisp lua m4 make markdown \
matlab node Node objc objc++ ocaml parrot \
pascal pdf Pdf perl Perl php Php \
png Png prolog python Python r rpm \
Rpm rst rtf Rtf ruby Ruby rust \
scala scheme shell Shell smalltalk sql svg \
swift tcl tex text tiff Tiff tt \
typescript verilog vhdl vim xml Xml yacc \
yaml
}
_choice_pattern() {
if [[ -n "$argc_regexp" ]] \
|| [[ -n "$argc_file" ]] \
; then
_argc_util_comp_path
fi
}
command eval "$(argc --argc-eval "$0" "$@")"