From 132fb662de1dd4031cd2adab4dd466799dbd9330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Sun, 6 Nov 2022 21:23:46 +0100 Subject: [PATCH] fix: compatibility with aoc-cli^0.4.0 (#7) Co-authored-by: Peter Anning <22272449+peteanning@users.noreply.github.com> --- src/bin/download.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/bin/download.rs b/src/bin/download.rs index 881f6af..85caa84 100644 --- a/src/bin/download.rs +++ b/src/bin/download.rs @@ -56,21 +56,23 @@ fn main() { exit_with_status(1, &tmp_file_path); } - println!("Downloading input via aoc-cli..."); - - let mut cmd_args = vec![ - "download".into(), - "--file".into(), - tmp_file_path.to_string_lossy().to_string(), - "--day".into(), - args.day.to_string(), - ]; + let mut cmd_args = vec![]; if let Some(year) = args.year { cmd_args.push("--year".into()); cmd_args.push(year.to_string()); } + cmd_args.append(&mut vec![ + "--file".into(), + tmp_file_path.to_string_lossy().to_string(), + "--day".into(), + args.day.to_string(), + "download".into(), + ]); + + println!("Downloading input with >aoc {}", cmd_args.join(" ")); + match Command::new("aoc").args(cmd_args).output() { Ok(cmd_output) => { io::stdout()