From db3c88d16b709a622fff390734f387693349341f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Aug 2021 11:45:01 -0700 Subject: Context flag: -c -> -C (to match grep), and confirm flag: -C -> -c --- README.md | 4 ++-- bp.1 | 4 ++-- bp.1.md | 4 ++-- bp.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 266b63b..8b52deb 100644 --- a/README.md +++ b/README.md @@ -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 ` provide a pattern (equivalent to `bp '\()'`) * `-r` `--replace ` replace the input pattern with the given replacement * `-s` `--skip ` skip over the given pattern when looking for matches -* `-c` `--context ` change how many lines of context are printed (`0`: no context, `all`: the whole file, `` matching lines and `` lines before/after) +* `-C` `--context ` change how many lines of context are printed (`0`: no context, `all`: the whole file, `` matching lines and `` lines before/after) * `-g` `--grammar ` 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) diff --git a/bp.1 b/bp.1 index 8a9be7f..2d884d8 100644 --- a/bp.1 +++ b/bp.1 @@ -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. diff --git a/bp.1.md b/bp.1.md index 13f98e7..b5cc6d8 100644 --- a/bp.1.md +++ b/bp.1.md @@ -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 diff --git a/bp.c b/bp.c index 51ab8ca..c8cfdaa 100644 --- a/bp.c +++ b/bp.c @@ -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 provide a pattern (equivalent to bp '\\()')\n" " -w --word find words matching the given string pattern\n" " -r --replace replace the input pattern with the given replacement\n" " -s --skip skip over the given pattern when looking for matches\n" - " -c --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 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 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")) { -- cgit v1.2.3