Skip to content

Commit

Permalink
fixed: txt file is None
Browse files Browse the repository at this point in the history
  • Loading branch information
zhifengle committed Feb 21, 2023
1 parent 520fe04 commit 8ad4b04
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ async fn main() -> anyhow::Result<()> {
RSS_JSON.get_or_init(|| matches.get_one::<PathBuf>("rss").map(|p| p.clone()));

if let Some(("magnet", matches)) = matches.subcommand() {
let link = matches.get_one::<String>("link").cloned();
let txt = matches.get_one::<PathBuf>("txt").cloned();
let cid = matches.get_one::<String>("cid").cloned();
let magnets = get_magnet_list_by_txt(&txt.unwrap())?;
let mut magnets: Vec<String> = Vec::new();
if txt.is_some() {
magnets = get_magnet_list_by_txt(&txt.unwrap())?;
} else if link.is_some() {
magnets.push(link.unwrap());
} else {
eprintln!("magnet link or txt file is required");
std::process::exit(1);
}
if let Err(err) = execute_magnets_task(&magnets, cid).await {
eprintln!("{}", err);
std::process::exit(1);
Expand Down

0 comments on commit 8ad4b04

Please sign in to comment.