summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-04-15 06:51:51 -0400
committerAndrew Gallant <jamslam@gmail.com>2019-04-15 06:51:51 -0400
commitef1611b5f5877a111b8f09fc2bd4cb0438347a5a (patch)
treec8c327ffc9fff7be4ded4ccc3f16e5a0421f7459
parent45d12abbc5f576d3b10ae13dc7410b14400a8d1e (diff)
ripgrep: max-column-preview --> max-columns-preview
Credit to @okdana for catching this. This naming is a bit more consistent with the existing --max-columns flag.
-rw-r--r--CHANGELOG.md2
-rw-r--r--GUIDE.md2
-rw-r--r--complete/_rg6
-rw-r--r--grep-printer/src/standard.rs30
-rw-r--r--src/app.rs14
-rw-r--r--src/args.rs6
-rw-r--r--tests/feature.rs8
7 files changed, 34 insertions, 34 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2ac8ef6..2bcfcb15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,7 +50,7 @@ Feature enhancements:
* [FEATURE #855](https://github.com/BurntSushi/ripgrep/issues/855):
Add `--binary` flag for disabling binary file filtering.
* [FEATURE #1078](https://github.com/BurntSushi/ripgrep/pull/1078):
- Add `--max-column-preview` flag for showing a preview of long lines.
+ Add `--max-columns-preview` flag for showing a preview of long lines.
* [FEATURE #1099](https://github.com/BurntSushi/ripgrep/pull/1099):
Add support for Brotli and Zstd to the `-z/--search-zip` flag.
* [FEATURE #1138](https://github.com/BurntSushi/ripgrep/pull/1138):
diff --git a/GUIDE.md b/GUIDE.md
index f6316137..aa7a2929 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -540,7 +540,7 @@ formatting peculiarities:
$ cat $HOME/.ripgreprc
# Don't let ripgrep vomit really long lines to my terminal, and show a preview.
--max-columns=150
---max-column-preview
+--max-columns-preview
# Add my 'web' type.
--type-add
diff --git a/complete/_rg b/complete/_rg
index ac3a52a1..86c5b6f9 100644
--- a/complete/_rg
+++ b/complete/_rg
@@ -153,9 +153,9 @@ _rg() {
$no"--no-crlf[don't use CRLF as line terminator]"
'(text)--null-data[use NUL as line terminator]'
- + '(max-column-preview)' # max column preview options
- '--max-column-preview[show preview for long lines (with -M)]'
- $no"--no-max-column-preview[don't show preview for long lines (with -M)]"
+ + '(max-columns-preview)' # max column preview options
+ '--max-columne-preview[show preview for long lines (with -M)]'
+ $no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
+ '(max-depth)' # Directory-depth options
'--max-depth=[specify max number of directories to descend]:number of directories'
diff --git a/grep-printer/src/standard.rs b/grep-printer/src/standard.rs
index f21b3675..b568c31b 100644
--- a/grep-printer/src/standard.rs
+++ b/grep-printer/src/standard.rs
@@ -34,7 +34,7 @@ struct Config {
per_match: bool,
replacement: Arc<Option<Vec<u8>>>,
max_columns: Option<u64>,
- max_column_preview: bool,
+ max_columns_preview: bool,
max_matches: Option<u64>,
column: bool,
byte_offset: bool,
@@ -58,7 +58,7 @@ impl Default for Config {
per_match: false,
replacement: Arc::new(None),
max_columns: None,
- max_column_preview: false,
+ max_columns_preview: false,
max_matches: None,
column: false,
byte_offset: false,
@@ -273,8 +273,8 @@ impl StandardBuilder {
/// If no limit is set, then enabling this has no effect.
///
/// This is disabled by default.
- pub fn max_column_preview(&mut self, yes: bool) -> &mut StandardBuilder {
- self.config.max_column_preview = yes;
+ pub fn max_columns_preview(&mut self, yes: bool) -> &mut StandardBuilder {
+ self.config.max_columns_preview = yes;
self
}
@@ -1273,7 +1273,7 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
matches: &[Match],
match_index: &mut usize,
) -> io::Result<()> {
- if self.config().max_column_preview {
+ if self.config().max_columns_preview {
let original = line;
let end = BStr::new(&bytes[line])
.grapheme_indices()
@@ -2342,7 +2342,7 @@ but Doctor Watson has to have it taken out for him and dusted,
let matcher = RegexMatcher::new("exhibited|dusted").unwrap();
let mut printer = StandardBuilder::new()
.max_columns(Some(46))
- .max_column_preview(true)
+ .max_columns_preview(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
.line_number(false)
@@ -2393,7 +2393,7 @@ but Doctor Watson has to have it taken out for him and dusted,
let mut printer = StandardBuilder::new()
.stats(true)
.max_columns(Some(46))
- .max_column_preview(true)
+ .max_columns_preview(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
.line_number(false)
@@ -2419,7 +2419,7 @@ and exhibited clearly, with a label attached.
let mut printer = StandardBuilder::new()
.stats(true)
.max_columns(Some(46))
- .max_column_preview(true)
+ .max_columns_preview(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
.line_number(false)
@@ -2447,7 +2447,7 @@ and exhibited clearly, with a label attached.
let mut printer = StandardBuilder::new()
.stats(true)
.max_columns(Some(46))
- .max_column_preview(true)
+ .max_columns_preview(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
.line_number(false)
@@ -2500,7 +2500,7 @@ but Doctor Watson has to have it taken out for him and dusted,
let mut printer = StandardBuilder::new()
.stats(true)
.max_columns(Some(46))
- .max_column_preview(true)
+ .max_columns_preview(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
.line_number(false)
@@ -2817,7 +2817,7 @@ Holmeses, success in the province of detective work must always
let mut printer = StandardBuilder::new()
.only_matching(true)
.max_columns(Some(10))
- .max_column_preview(true)
+ .max_columns_preview(true)
.column(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
@@ -2885,7 +2885,7 @@ Holmeses, success in the province of detective work must always
let mut printer = StandardBuilder::new()
.only_matching(true)
.max_columns(Some(10))
- .max_column_preview(true)
+ .max_columns_preview(true)
.column(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
@@ -2947,7 +2947,7 @@ Holmeses, success in the province of detective work must always
let mut printer = StandardBuilder::new()
.only_matching(true)
.max_columns(Some(50))
- .max_column_preview(true)
+ .max_columns_preview(true)
.column(true)
.build(NoColor::new(vec![]));
SearcherBuilder::new()
@@ -3171,7 +3171,7 @@ Holmeses, success in the province of detective work must always
let matcher = RegexMatcher::new(r"Sherlock|Doctor (\w+)").unwrap();
let mut printer = StandardBuilder::new()
.max_columns(Some(67))
- .max_column_preview(true)
+ .max_columns_preview(true)
.replacement(Some(b"doctah $1 MD".to_vec()))
.build(NoColor::new(vec![]));
SearcherBuilder::new()
@@ -3200,7 +3200,7 @@ Holmeses, success in the province of detective work must always
).unwrap();
let mut printer = StandardBuilder::new()
.max_columns(Some(43))
- .max_column_preview(true)
+ .max_columns_preview(true)
.replacement(Some(b"xxx".to_vec()))
.build(NoColor::new(vec![]));
SearcherBuilder::new()
diff --git a/src/app.rs b/src/app.rs
index 7ec54118..a4f0aa58 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -583,7 +583,7 @@ pub fn all_args_and_flags() -> Vec<RGArg> {
flag_line_number(&mut args);
flag_line_regexp(&mut args);
flag_max_columns(&mut args);
- flag_max_column_preview(&mut args);
+ flag_max_columns_preview(&mut args);
flag_max_count(&mut args);
flag_max_depth(&mut args);
flag_max_filesize(&mut args);
@@ -1490,7 +1490,7 @@ When this flag is omitted or is set to 0, then it has no effect.
args.push(arg);
}
-fn flag_max_column_preview(args: &mut Vec<RGArg>) {
+fn flag_max_columns_preview(args: &mut Vec<RGArg>) {
const SHORT: &str = "Print a preview for lines exceeding the limit.";
const LONG: &str = long!("\
When the '--max-columns' flag is used, ripgrep will by default completely
@@ -1501,16 +1501,16 @@ of the line exceeding the limit is not shown.
If the '--max-columns' flag is not set, then this has no effect.
-This flag can be disabled with '--no-max-column-preview'.
+This flag can be disabled with '--no-max-columns-preview'.
");
- let arg = RGArg::switch("max-column-preview")
+ let arg = RGArg::switch("max-columns-preview")
.help(SHORT).long_help(LONG)
- .overrides("no-max-column-preview");
+ .overrides("no-max-columns-preview");
args.push(arg);
- let arg = RGArg::switch("no-max-column-preview")
+ let arg = RGArg::switch("no-max-columns-preview")
.hidden()
- .overrides("max-column-preview");
+ .overrides("max-columns-preview");
args.push(arg);
}
diff --git a/src/args.rs b/src/args.rs
index 80693da8..cd217b4b 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -778,7 +778,7 @@ impl ArgMatches {
.per_match(self.is_present("vimgrep"))
.replacement(self.replacement())
.max_columns(self.max_columns()?)
- .max_column_preview(self.max_column_preview())
+ .max_columns_preview(self.max_columns_preview())
.max_matches(self.max_count()?)
.column(self.column())
.byte_offset(self.is_present("byte-offset"))
@@ -1177,8 +1177,8 @@ impl ArgMatches {
/// Returns true if and only if a preview should be shown for lines that
/// exceed the maximum column limit.
- fn max_column_preview(&self) -> bool {
- self.is_present("max-column-preview")
+ fn max_columns_preview(&self) -> bool {
+ self.is_present("max-columns-preview")
}
/// The maximum number of matches permitted.
diff --git a/tests/feature.rs b/tests/feature.rs
index be9f4bec..13e87535 100644
--- a/tests/feature.rs
+++ b/tests/feature.rs
@@ -633,10 +633,10 @@ rgtest!(f993_null_data, |dir: Dir, mut cmd: TestCommand| {
// See: https://github.com/BurntSushi/ripgrep/issues/1078
//
// N.B. There are many more tests in the grep-printer crate.
-rgtest!(f1078_max_column_preview1, |dir: Dir, mut cmd: TestCommand| {
+rgtest!(f1078_max_columns_preview1, |dir: Dir, mut cmd: TestCommand| {
dir.create("sherlock", SHERLOCK);
cmd.args(&[
- "-M46", "--max-column-preview",
+ "-M46", "--max-columns-preview",
"exhibited|dusted|has to have it",
]);
@@ -647,10 +647,10 @@ sherlock:and exhibited clearly, with a label attached.
eqnice!(expected, cmd.stdout());
});
-rgtest!(f1078_max_column_preview2, |dir: Dir, mut cmd: TestCommand| {
+rgtest!(f1078_max_columns_preview2, |dir: Dir, mut cmd: TestCommand| {
dir.create("sherlock", SHERLOCK);
cmd.args(&[
- "-M43", "--max-column-preview",
+ "-M43", "--max-columns-preview",
// Doing a replacement forces ripgrep to show the number of remaining
// matches. Normally, this happens by default when printing a tty with
// colors.