summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-04-23 19:25:55 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-04-23 19:26:58 -0400
commitb75526bd7f92529c8e49c9795d3c0e6bc4143721 (patch)
tree33a801e2a934eb6f7ae8478357a2efb86b4aa66c /src
parent507801c1f2efdc45ea25227a613c2e38cdecf88b (diff)
output: add --no-column flag
This disables columns in the output if they were otherwise enabled. Fixes #880
Diffstat (limited to 'src')
-rw-r--r--src/app.rs10
-rw-r--r--src/args.rs3
2 files changed, 12 insertions, 1 deletions
diff --git a/src/app.rs b/src/app.rs
index a0b4eaf6..2c3bfe43 100644
--- a/src/app.rs
+++ b/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);
}
diff --git a/src/args.rs b/src/args.rs
index 96abec27..516a4d04 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -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")
}