Skip to content

Commit

Permalink
Cleaned up terminal-width validation even more
Browse files Browse the repository at this point in the history
  • Loading branch information
eth-p authored and sharkdp committed May 10, 2019
1 parent 89fcbb2 commit 7ef0fe0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.validator(
|t| {
let is_offset = t.starts_with('+') || t.starts_with('-');
let num = if is_offset {
t.chars().skip(1).collect()
} else {
t
};

num.parse::<u32>()
t.parse::<i32>()
.map_err(|_e| "must be an offset or number")
.and_then(|v| if v == 0 && !is_offset {
Err("terminal width cannot be zero".into())
Expand Down

0 comments on commit 7ef0fe0

Please sign in to comment.