Skip to content

Commit

Permalink
error if both metric and imperial are requested at the same time
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin Naren <[email protected]>
  • Loading branch information
arihant2math committed Dec 3, 2023
1 parent b639110 commit 377cec6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/weather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ fn run() -> Result<()> {
if settings_s.debug || args.global_opts.debug {
let _handle = init_logging();
}

if args.global_opts.metric && args.global_opts.imperial {
return Err("Cannot use both metric and imperial units at the same time.")?;
}

let true_metric = if args.global_opts.metric {
true
} else if args.global_opts.imperial {
Expand Down

0 comments on commit 377cec6

Please sign in to comment.