Skip to content

Commit 0962e40

Browse files
authored
move code to already existing check
1 parent e4d2275 commit 0962e40

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/uu/pr/src/pr.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,17 +778,19 @@ fn build_options(
778778
// --column has more priority than -column
779779

780780
let column_option_value = match parse_usize(matches, options::COLUMN) {
781-
Some(res) => Some(res?),
781+
Some(Ok(0)) => {
782+
// if --column is zero, exit with code 1.
783+
return Err(PrError::EncounteredErrors {
784+
msg: "invalid -column argument '0'".to_string(),
785+
});
786+
}
787+
Some(res) => {
788+
println!("{:?}", res);
789+
Some(res?)
790+
}
782791
None => start_column_option,
783792
};
784793

785-
// exit with code 1 if column argument is 0.
786-
if column_option_value == Some(0) {
787-
return Err(PrError::EncounteredErrors {
788-
msg: "invalid -column argument '0'".to_string(),
789-
});
790-
}
791-
792794
let column_mode_options = column_option_value.map(|columns| ColumnModeOptions {
793795
columns,
794796
width: column_width,

0 commit comments

Comments
 (0)