mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-06-06 05:49:01 +08:00
Do not panic if command line have unreconginzed option.
Return 1 if no command is parsed.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
/proc_macros/target
|
||||
.vscode/
|
||||
test/
|
||||
.workspace/
|
||||
|
||||
@@ -112,7 +112,7 @@ impl Main {
|
||||
pub fn run(&mut self) -> i32 {
|
||||
self.cmd = opts::parse_cmd();
|
||||
if self.cmd.is_none() {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
let cmd = self.cmd.as_ref().unwrap();
|
||||
self.settings = Some(SettingStore::default());
|
||||
|
||||
@@ -191,7 +191,8 @@ pub fn parse_cmd() -> Option<CommandOpts> {
|
||||
let result = match opts.parse(&argv[1..]) {
|
||||
Ok(m) => m,
|
||||
Err(err) => {
|
||||
panic!("{}", err.to_string())
|
||||
println!("{}", err.to_string());
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if result.opt_present("h") || result.free.len() == 0 {
|
||||
|
||||
Reference in New Issue
Block a user