~nicohman/wyvern

26bacccbf384b440d14f2dc2b9e428b9452cb118 — nicohman 5 years ago 694651c + cb3d498
Merge branch 'master' of git.sr.ht:~nicohman/wyvern
2 files changed, 17 insertions(+), 3 deletions(-)

M src/args.rs
M src/main.rs
M src/args.rs => src/args.rs +2 -0
@@ 35,6 35,8 @@ pub enum Command {
        #[structopt(short = "o", long = "output-folder", help = "Name of folder to output extras to")]
        output: Option<PathBuf>,
        game: Option<String>,
        #[structopt(short = "s", long = "slug", help =  "Download a single extra by slug name")]
        slug: Option<String>
    },
    #[derive(Default)]
    #[cfg(feature = "eidolonint")]

M src/main.rs => src/main.rs +15 -3
@@ 233,8 233,9 @@ fn parse_args(
            game,
            all,
            first,
            slug,
            id,
            output
            output,
        } => {
            let mut details: GameDetails;
            if let Some(search) = game {


@@ 256,7 257,6 @@ fn parse_args(
                        i = select.interact().unwrap();
                    }
                    info!("Fetching game details");

                    details = gog.get_game_details(e[i].id).unwrap();
                } else {
                    error!("Could not search for games.");


@@ 285,7 285,7 @@ fn parse_args(
                fs::create_dir(&folder_name).expect("Couldn't create extras folder");
            }
            let mut picked: Vec<usize> = vec![];
            if !all {
            if !all && slug.is_none() {
                let mut check = Checkboxes::new();
                let mut checks = check.with_prompt("Pick the extras you want to download");
                for ex in details.extras.iter() {


@@ 293,6 293,18 @@ fn parse_args(
                }
                picked = checks.interact().unwrap();
            }
            if let Some(slug) = slug {
                details.extras.iter().enumerate().for_each(|(i, x)| {
                    if x.name.trim() == slug.trim() {
                        picked.push(i);
                    }
                });
                if picked.len() == 0 {
                    error!("Couldn't find an extra named {}", slug);
                    return Ok(gog);
                }
            }

            let extra_responses: Vec<Result<reqwest::Response, Error>> = details
                .extras
                .iter()