From a4a494a5bc1ba1749808763560f7e646c175c885 Mon Sep 17 00:00:00 2001 From: Peltoche Date: Sun, 2 Dec 2018 18:19:57 +0100 Subject: [PATCH] Add the -1 option --- src/display.rs | 2 +- src/main.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/display.rs b/src/display.rs index 220a8bb..0ce1f0f 100644 --- a/src/display.rs +++ b/src/display.rs @@ -12,7 +12,7 @@ impl<'a> Display<'a> { } pub fn print_outputs(&self, outputs: Vec) { - if self.options.display_long { + if self.options.display_long || self.options.display_online { self.print_one_per_line(&outputs); } else { self.print_grid(outputs); diff --git a/src/main.rs b/src/main.rs index a9cff78..739d018 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,19 +21,22 @@ use core::Core; pub struct Options { pub display_all: bool, pub display_long: bool, + pub display_online: bool, } fn main() { let matches = App::new("lsd") .about("A ls comment with a lot of pretty colors and some other stuff.") .arg(Arg::with_name("FILE").multiple(true).default_value(".")) - .arg(Arg::with_name("all").short("a")) - .arg(Arg::with_name("long").short("l")) + .arg(Arg::with_name("all").short("a").long("all")) + .arg(Arg::with_name("long").short("l").long("long")) + .arg(Arg::with_name("oneline").short("1").long("oneline")) .get_matches(); let options = Options { display_all: matches.is_present("all"), display_long: matches.is_present("long"), + display_online: matches.is_present("oneline"), }; let inputs: Vec<&str> = matches