Parse booleans from CLI flags
This commit is contained in:
parent
25bf4db796
commit
507b0e0594
|
@ -46,10 +46,14 @@ impl Provider for CliProvider {
|
|||
// TODO: Parse _args as booleans
|
||||
let (_args, argv) = argmap::parse(args.iter());
|
||||
|
||||
let mut dict = Dict::new();
|
||||
let mut tree = ArgumentTree::new();
|
||||
for (key, vals) in argv {
|
||||
let len = vals.len();
|
||||
if len == 0 {
|
||||
// This is usually where booleans are given (use_cache, replace_torrents, etc.)
|
||||
dict.insert(key, Value::Bool(Tag::Default, true));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -71,7 +75,9 @@ impl Provider for CliProvider {
|
|||
tree.insert(&mut key_iter, val);
|
||||
}
|
||||
|
||||
Ok(tree.to_dict())
|
||||
dict.append(&mut tree.to_dict());
|
||||
|
||||
Ok(dict)
|
||||
}
|
||||
|
||||
match &self.profile {
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -74,18 +74,7 @@ async fn main() {
|
|||
|
||||
for torrent_path in torrent_files.iter() {
|
||||
let torrent = Torrent::read_from_file(torrent_path).unwrap();
|
||||
|
||||
// To check for private torrents
|
||||
/* if let Some(extra_info) = &torrent.extra_info_fields {
|
||||
if let Some(BencodeElem::Integer(is_private)) = extra_info.get("private") {
|
||||
if *is_private == 1 {
|
||||
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
let torrent = Arc::new(torrent);
|
||||
//info!("{}:", torrent.name);
|
||||
|
||||
for indexer in indexers.iter() {
|
||||
let mut indexer = Arc::clone(indexer);
|
||||
|
|
Loading…
Reference in New Issue