From 9349a2de648e241da8e00ba7ae25cb2a877ff3e9 Mon Sep 17 00:00:00 2001 From: Doan Luu Duc Tai Date: Sun, 1 Nov 2026 07:13:45 -0600 Subject: feat(guix): carry prebuilt runtime and recover preserved state --- src/app/cli.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/app/cli.rs') diff --git a/src/app/cli.rs b/src/app/cli.rs index 1830ec1..f886812 100644 --- a/src/app/cli.rs +++ b/src/app/cli.rs @@ -72,6 +72,7 @@ pub(super) enum Action { Restore { archive: PathBuf, destination: PathBuf, + release: bool, }, Check, @@ -135,6 +136,7 @@ fn archives() -> [Command; 4] { .args([ path("archive").required(true), path("destination").required(true), + flag("release").help("Require a public release archive"), ]), Command::new("release") .about("Check and build a portable production release locally") @@ -227,6 +229,7 @@ fn action(name: &str, args: &mut ArgMatches) -> Result { "restore" => Action::Restore { archive: required(args, "archive")?, destination: required(args, "destination")?, + release: args.get_flag("release"), }, "check" => Action::Check, "release" => Action::Release { @@ -271,6 +274,22 @@ mod tests { use anyhow::Result; use std::path::PathBuf; + #[test] + fn restore_accepts_release_requirement() -> Result<()> { + let parsed = Cli::try_parse_from([ + "stack", + "restore", + "--release", + "release.tar.gz", + "new-root", + ])?; + anyhow::ensure!( + matches!(parsed.command, Action::Restore { release: true, .. }), + "Release requirement missing" + ); + Ok(()) + } + #[test] fn checked_command_schema() { command().debug_assert(); @@ -321,7 +340,7 @@ mod tests { anyhow::ensure!(Cli::try_parse_from(args).is_err(), "Test invariant failed"); } anyhow::ensure!( - matches!(Cli::try_parse_from(["stack", "restore", "export.gpg", "new-root"])?.command, Action::Restore { archive, destination } if archive == std::path::Path::new("export.gpg") && destination == std::path::Path::new("new-root")), + matches!(Cli::try_parse_from(["stack", "restore", "export.gpg", "new-root"])?.command, Action::Restore { archive, destination, release: false } if archive == std::path::Path::new("export.gpg") && destination == std::path::Path::new("new-root")), "Test invariant failed" ); Ok(()) -- cgit v1.2.3