mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 04:02:00 -07:00
output: add --no-column flag
This disables columns in the output if they were otherwise enabled. Fixes #880
This commit is contained in:
10
src/app.rs
10
src/app.rs
@@ -741,9 +741,17 @@ fn flag_column(args: &mut Vec<RGArg>) {
|
||||
Show column numbers (1-based). This only shows the column numbers for the first
|
||||
match on each line. This does not try to account for Unicode. One byte is equal
|
||||
to one column. This implies --line-number.
|
||||
|
||||
This flag can be disabled with --no-column.
|
||||
");
|
||||
let arg = RGArg::switch("column")
|
||||
.help(SHORT).long_help(LONG);
|
||||
.help(SHORT).long_help(LONG)
|
||||
.overrides("no-column");
|
||||
args.push(arg);
|
||||
|
||||
let arg = RGArg::switch("no-column")
|
||||
.hidden()
|
||||
.overrides("column");
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
|
@@ -689,6 +689,9 @@ impl<'a> ArgMatches<'a> {
|
||||
|
||||
/// Returns true if and only if column numbers should be shown.
|
||||
fn column(&self) -> bool {
|
||||
if self.is_present("no-column") {
|
||||
return false;
|
||||
}
|
||||
self.is_present("column") || self.is_present("vimgrep")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user