summaryrefslogtreecommitdiff
path: root/src/app/cli.rs
diff options
context:
space:
mode:
authorDoan Luu Duc Tai <doan@luuduct.ai>2026-11-01 07:13:45 -0600
committerDoan Luu Duc Tai <doan@luuduct.ai>2026-11-01 07:13:45 -0600
commit9349a2de648e241da8e00ba7ae25cb2a877ff3e9 (patch)
tree2fea913ee0aaff4370877f4a91c911db2fe37592 /src/app/cli.rs
parent5b89c370d5974f057306a52089f14c337565fd1d (diff)
feat(guix): carry prebuilt runtime and recover preserved state
Diffstat (limited to 'src/app/cli.rs')
-rw-r--r--src/app/cli.rs21
1 files changed, 20 insertions, 1 deletions
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<Action, clap::Error> {
"restore" => Action::Restore {
archive: required(args, "archive")?,
destination: required(args, "destination")?,
+ release: args.get_flag("release"),
},
"check" => Action::Check,
"release" => Action::Release {
@@ -272,6 +275,22 @@ mod tests {
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(())