From d1a1943998038996f409910c6e461cf2d584f1ae Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sat, 19 May 2018 14:01:44 +0200 Subject: [PATCH] Add -u and -n options, see #134 --- src/app.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 228add91..07194b61 100644 --- a/src/app.rs +++ b/src/app.rs @@ -110,6 +110,18 @@ impl App { .long("list-themes") .help("Displays supported themes"), ) + .arg( + Arg::with_name("number") + .long("number") + .short("n") + .conflicts_with("style") + .help("Alias for '--style=numbers'"), + ) + .arg( + Arg::with_name("unbuffered") + .short("u") + .help("(ignored)"), + ) .subcommand( SubCommand::with_name("cache") .about("Modify the syntax-definition and theme cache") @@ -226,15 +238,17 @@ impl App { fn output_components(&self) -> Result { let matches = &self.matches; - Ok(OutputComponents( + Ok(OutputComponents(if matches.is_present("number") { + [OutputComponent::Numbers].iter().cloned().collect() + } else { values_t!(matches.values_of("style"), OutputComponent)? .into_iter() .map(|style| style.components(self.interactive_output)) .fold(HashSet::new(), |mut acc, components| { acc.extend(components.iter().cloned()); acc - }), - )) + }) + })) } }