~nicohman/wyvern

da0e05d00c46ed3b15a4ca44a777e22860c70dcb — nicohman 5 years ago 8b281f4
Add --output-folder option to extras
2 files changed, 8 insertions(+), 1 deletions(-)

M src/args.rs
M src/main.rs
M src/args.rs => src/args.rs +3 -0
@@ 31,6 31,9 @@ pub enum Command {
        first: bool,
        #[structopt(short = "i", long = "id", help = "Download a game's extras by id")]
        id: Option<i64>,
        #[structopt(parse(from_os_str))]
        #[structopt(short = "o", long = "output-folder", help = "Name of folder to output extras to")]
        output: Option<PathBuf>,
        game: Option<String>,
    },
    #[derive(Default)]

M src/main.rs => src/main.rs +5 -1
@@ 234,6 234,7 @@ fn parse_args(
            all,
            first,
            id,
            output
        } => {
            let mut details: GameDetails;
            if let Some(search) = game {


@@ 276,7 277,10 @@ fn parse_args(
                return Ok(gog);
            }
            println!("Downloading extras for game {}", details.title);
            let folder_name = PathBuf::from(format!("{} Extras", details.title));
            let mut folder_name = PathBuf::from(format!("{} Extras", details.title));
            if let Some(output) = output {
                folder_name = output;
            }
            if fs::metadata(&folder_name).is_err() {
                fs::create_dir(&folder_name).expect("Couldn't create extras folder");
            }