Fix print help message will return 1

This commit is contained in:
2022-05-24 03:43:30 +00:00
committed by GitHub
parent 5ccbfecb89
commit 4d3dd16950
2 changed files with 7 additions and 1 deletions

View File

@@ -140,6 +140,9 @@ impl Main {
Command::Download => {
return self.download();
}
Command::None => {
return 0;
}
}
0
}

View File

@@ -19,6 +19,8 @@ pub enum Command {
Config,
/// Download an artwork
Download,
/// Already handled when parsing options, just need return 0.
None,
}
/// Subcommand for config
@@ -197,7 +199,7 @@ pub fn parse_cmd() -> Option<CommandOpts> {
};
if result.opt_present("h") || result.free.len() == 0 {
print_usage(&argv[0], &opts);
return None;
return Some(CommandOpts::new(Command::None));
}
let cmd = &result.free[0];
let mut re = if cmd == "download" {
@@ -250,6 +252,7 @@ pub fn parse_cmd() -> Option<CommandOpts> {
return None;
}
}
Command::None => {}
}
if result.opt_present("config") {
re.as_mut().unwrap()._config = Some(result.opt_str("config").unwrap());