mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +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
|
/proc_macros/target
|
||||||
.vscode/
|
.vscode/
|
||||||
test/
|
test/
|
||||||
|
.workspace/
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ impl Main {
|
|||||||
pub fn run(&mut self) -> i32 {
|
pub fn run(&mut self) -> i32 {
|
||||||
self.cmd = opts::parse_cmd();
|
self.cmd = opts::parse_cmd();
|
||||||
if self.cmd.is_none() {
|
if self.cmd.is_none() {
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
let cmd = self.cmd.as_ref().unwrap();
|
let cmd = self.cmd.as_ref().unwrap();
|
||||||
self.settings = Some(SettingStore::default());
|
self.settings = Some(SettingStore::default());
|
||||||
|
|||||||
@@ -191,7 +191,8 @@ pub fn parse_cmd() -> Option<CommandOpts> {
|
|||||||
let result = match opts.parse(&argv[1..]) {
|
let result = match opts.parse(&argv[1..]) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
panic!("{}", err.to_string())
|
println!("{}", err.to_string());
|
||||||
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if result.opt_present("h") || result.free.len() == 0 {
|
if result.opt_present("h") || result.free.len() == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user