Permalink
Browse files

limit width to 80 unless --files is specified (#289)

  • Loading branch information...
matklad authored and Aaronepower committed Jan 22, 2019
1 parent 676dd5b commit 4fa3773e53a6ebe486fe6a0dcbdfc38c8dfb2198
Showing with 8 additions and 4 deletions.
  1. +1 −1 src/cli.rs
  2. +7 −3 src/main.rs
@@ -62,7 +62,7 @@ impl<'a> Cli<'a> {
3: enable file level trace. Not recommended on multiple files")
).get_matches();

let columns = matches.value_of("columns").and_then(|s| s.parse().ok());
let columns = matches.value_of("columns").map(parse_or_exit::<usize>);
let files = matches.is_present("files");
let print_languages = matches.is_present("languages");
let verbose = matches.occurrences_of("verbose");
@@ -49,9 +49,13 @@ fn main() -> Result<(), Box<Error>> {
}

let columns = cli.columns.or(config.columns).unwrap_or_else(|| {
term_size::dimensions().map_or(FALLBACK_ROW_LEN, |(w, _)| {
w.max(FALLBACK_ROW_LEN)
})
if cli.files {
term_size::dimensions().map_or(FALLBACK_ROW_LEN, |(w, _)| {
w.max(FALLBACK_ROW_LEN)
})
} else {
FALLBACK_ROW_LEN
}
});


0 comments on commit 4fa3773

Please sign in to comment.