Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli.rs
Expand Up @@ -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");
Expand Down
10 changes: 7 additions & 3 deletions src/main.rs
Expand Up @@ -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
}
});


Expand Down