diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-08-02 11:45:01 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-08-02 11:45:01 -0700 |
| commit | db3c88d16b709a622fff390734f387693349341f (patch) | |
| tree | 653cdd582df834d844430c1ba5e1566da8fe0be7 | |
| parent | 53ccb56542ffd78c36bf4d18d28f484b1a4d53d3 (diff) | |
Context flag: -c -> -C (to match grep), and confirm flag: -C -> -c
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | bp.1 | 4 | ||||
| -rw-r--r-- | bp.1.md | 4 | ||||
| -rw-r--r-- | bp.c | 8 |
4 files changed, 10 insertions, 10 deletions
@@ -15,14 +15,14 @@ It's written in pure C with no dependencies. * `-v` `--verbose` print verbose debugging info * `-i` `--ignore-case` perform a case-insensitive match * `-I` `--inplace` perform replacements or filtering in-place on files -* `-C` `--confirm` during replacement, confirm before each replacement +* `-c` `--confirm` during replacement, confirm before each replacement * `-e` `--explain` print an explanation of the matches * `-j` `--json` print matches as JSON objects * `-l` `--list-files` print only filenames containing matches * `-p` `--pattern <pat>` provide a pattern (equivalent to `bp '\(<pat>)'`) * `-r` `--replace <replacement>` replace the input pattern with the given replacement * `-s` `--skip <skip pattern>` skip over the given pattern when looking for matches -* `-c` `--context <N>` change how many lines of context are printed (`0`: no context, `all`: the whole file, `<N>` matching lines and `<N-1>` lines before/after) +* `-C` `--context <N>` change how many lines of context are printed (`0`: no context, `all`: the whole file, `<N>` matching lines and `<N-1>` lines before/after) * `-g` `--grammar <grammar file>` use the specified file as a grammar * `-G` `--git` get filenames from git * `-f` `--format` `auto|plain|fancy` set the output format (`fancy` includes colors and line numbers) @@ -41,7 +41,7 @@ Perform pattern matching case-insensitively. Perform filtering or replacement in-place (i.e.\ overwrite files with new content). .TP -\f[B]-C\f[R], \f[B]--confirm\f[R] +\f[B]-c\f[R], \f[B]--confirm\f[R] During in-place modification of a file, confirm before each modification. .TP @@ -62,7 +62,7 @@ Use \f[B]git\f[R] to get a list of files. Remaining file arguments (if any) are passed to \f[B]git --ls-files\f[R] instead of treated as literal files. .TP -\f[B]-c\f[R], \f[B]--context\f[R] \f[I]N\f[R] +\f[B]-C\f[R], \f[B]--context\f[R] \f[I]N\f[R] The number of lines of context to print. If \f[I]N\f[R] is 0, print only the exact text of the matches. If \f[I]N\f[R] is \f[B]\[lq]all\[rq]\f[R], print the entire file. @@ -42,7 +42,7 @@ themselves. : Perform filtering or replacement in-place (i.e. overwrite files with new content). -`-C`, `--confirm` +`-c`, `--confirm` : During in-place modification of a file, confirm before each modification. `-r`, `--replace` *replacement* @@ -61,7 +61,7 @@ for more info. : Use `git` to get a list of files. Remaining file arguments (if any) are passed to `git --ls-files` instead of treated as literal files. -`-c`, `--context` *N* +`-C`, `--context` *N* : The number of lines of context to print. If *N* is 0, print only the exact text of the matches. If *N* is **"all"**, print the entire file. Otherwise, if *N* is a positive integer, print the whole line on which @@ -45,13 +45,13 @@ static const char *usage = ( " -j --json print matches as a list of JSON objects\n" " -i --ignore-case preform matching case-insensitively\n" " -I --inplace modify a file in-place\n" - " -C --confirm ask for confirmation on each replacement\n" + " -c --confirm ask for confirmation on each replacement\n" " -l --list-files list filenames only\n" " -p --pattern <pat> provide a pattern (equivalent to bp '\\(<pat>)')\n" " -w --word <string-pat> find words matching the given string pattern\n" " -r --replace <replacement> replace the input pattern with the given replacement\n" " -s --skip <skip-pattern> skip over the given pattern when looking for matches\n" - " -c --context <context> set number of lines of context to print (all: the whole file, 0: only the match, 1: the line, N: N lines of context)\n" + " -C --context <context> set number of lines of context to print (all: the whole file, 0: only the match, 1: the line, N: N lines of context)\n" " -f --format auto|fancy|plain set the output format\n" " -g --grammar <grammar-file> use the specified file as a grammar"); @@ -515,7 +515,7 @@ int main(int argc, char *argv[]) options.mode = MODE_JSON; } else if (BOOLFLAG("-I") || BOOLFLAG("--inplace")) { options.mode = MODE_INPLACE; - } else if (BOOLFLAG("-C") || BOOLFLAG("--confirm")) { + } else if (BOOLFLAG("-c") || BOOLFLAG("--confirm")) { options.confirm = CONFIRM_ASK; } else if (BOOLFLAG("-G") || BOOLFLAG("--git")) { options.git_mode = true; @@ -566,7 +566,7 @@ int main(int argc, char *argv[]) "Failed to compile part of the skip argument"); } options.skip = either_pat(arg_file, options.skip, s); - } else if (FLAG("-c") || FLAG("--context")) { + } else if (FLAG("-C") || FLAG("--context")) { if (streq(flag, "all")) { options.context_lines = ALL_CONTEXT; } else if (streq(flag, "none")) { |
