Add the -1 option

This commit is contained in:
Peltoche 2018-12-02 18:19:57 +01:00
parent 9e16d6620b
commit a4a494a5bc
No known key found for this signature in database
GPG key ID: CED68D0487156952
2 changed files with 6 additions and 3 deletions

View file

@ -12,7 +12,7 @@ impl<'a> Display<'a> {
} }
pub fn print_outputs(&self, outputs: Vec<String>) { pub fn print_outputs(&self, outputs: Vec<String>) {
if self.options.display_long { if self.options.display_long || self.options.display_online {
self.print_one_per_line(&outputs); self.print_one_per_line(&outputs);
} else { } else {
self.print_grid(outputs); self.print_grid(outputs);

View file

@ -21,19 +21,22 @@ use core::Core;
pub struct Options { pub struct Options {
pub display_all: bool, pub display_all: bool,
pub display_long: bool, pub display_long: bool,
pub display_online: bool,
} }
fn main() { fn main() {
let matches = App::new("lsd") let matches = App::new("lsd")
.about("A ls comment with a lot of pretty colors and some other stuff.") .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("FILE").multiple(true).default_value("."))
.arg(Arg::with_name("all").short("a")) .arg(Arg::with_name("all").short("a").long("all"))
.arg(Arg::with_name("long").short("l")) .arg(Arg::with_name("long").short("l").long("long"))
.arg(Arg::with_name("oneline").short("1").long("oneline"))
.get_matches(); .get_matches();
let options = Options { let options = Options {
display_all: matches.is_present("all"), display_all: matches.is_present("all"),
display_long: matches.is_present("long"), display_long: matches.is_present("long"),
display_online: matches.is_present("oneline"),
}; };
let inputs: Vec<&str> = matches let inputs: Vec<&str> = matches