1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-07-16 22:42:20 +02:00

output: remove --line-number-width flag

This commit does what no software project has ever done before: we've
outright removed a flag with no possible way to recapture its
functionality.

This flag presents numerous problems in that it never really worked well
in the first place, and completely falls over when ripgrep uses the
--no-heading output format. Well meaning users want ripgrep to fix this
by getting into the alignment business by buffering all output, but that
is a line that I refuse to cross.

Fixes #795
This commit is contained in:
Andrew Gallant
2018-04-23 19:57:22 -04:00
parent ed059559cd
commit ae6f871491
5 changed files with 1 additions and 65 deletions

View File

@ -475,23 +475,6 @@ impl RGArg {
});
self
}
/// Indicate that any value given to this argument should be a valid
/// line number width. A valid line number width cannot start with `0`
/// to maintain compatibility with future improvements that add support
/// for padding character specifies.
fn line_number_width(mut self) -> RGArg {
self.claparg = self.claparg.validator(|val| {
if val.starts_with("0") {
Err(String::from(
"Custom padding characters are currently not supported. \
Please enter only a numeric value."))
} else {
val.parse::<usize>().map(|_| ()).map_err(|err| err.to_string())
}
});
self
}
}
// We add an extra space to long descriptions so that a black line is inserted
@ -535,7 +518,6 @@ pub fn all_args_and_flags() -> Vec<RGArg> {
flag_ignore_file(&mut args);
flag_invert_match(&mut args);
flag_line_number(&mut args);
flag_line_number_width(&mut args);
flag_line_regexp(&mut args);
flag_max_columns(&mut args);
flag_max_count(&mut args);
@ -1100,18 +1082,6 @@ terminal.
args.push(arg);
}
fn flag_line_number_width(args: &mut Vec<RGArg>) {
const SHORT: &str = "Left pad line numbers up to NUM width.";
const LONG: &str = long!("\
Left pad line numbers up to NUM width. Space is used as the default padding
character. This has no effect if --no-line-number is enabled.
");
let arg = RGArg::flag("line-number-width", "NUM")
.help(SHORT).long_help(LONG)
.line_number_width();
args.push(arg);
}
fn flag_line_regexp(args: &mut Vec<RGArg>) {
const SHORT: &str = "Only show matches surrounded by line boundaries.";
const LONG: &str = long!("\