Skip to content

Commit

Permalink
Use sub_matches to get args for the download command (#26)
Browse files Browse the repository at this point in the history
Closes #25
  • Loading branch information
smbl64 authored May 6, 2023
1 parent 96ea1e6 commit d502b4f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "humble-cli"
authors = ["Mohammad Banisaeid <[email protected]>"]
version = "0.10.0"
version = "0.11.0"
license = "MIT"
description = "The missing CLI for downloading your Humble Bundle purchases"
documentation = "https://github.com/smbl64/humble-cli"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ After that you will have access to the following sub-commands:
```
$ humble-cli --help
humble-cli 0.10.0
humble-cli 0.11.0
The missing Humble Bundle CLI
USAGE:
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,18 @@ fn run() -> Result<(), anyhow::Error> {
}
Some(("download", sub_matches)) => {
let bundle_key = sub_matches.value_of("BUNDLE-KEY").unwrap();
let formats = if let Some(values) = matches.values_of("format") {
let formats = if let Some(values) = sub_matches.values_of("format") {
values.map(|f| f.to_lowercase()).collect::<Vec<_>>()
} else {
vec![]
};
let max_size: u64 = if let Some(byte_str) = matches.value_of("max-size") {
let max_size: u64 = if let Some(byte_str) = sub_matches.value_of("max-size") {
byte_string_to_number(byte_str)
.context(format!("failed to parse the specified size: {}", byte_str))?
} else {
0
};
let item_numbers = matches.value_of("item-numbers");
let item_numbers = sub_matches.value_of("item-numbers");
download_bundle(bundle_key, formats, max_size, item_numbers)
}
Some(("list", sub_matches)) => {
Expand Down

0 comments on commit d502b4f

Please sign in to comment.