From 37f7800766fe12af43d0cdba13aea9545cbe7755 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sun, 20 Jan 2019 13:56:48 -0800 Subject: Add test for storage hidden subcommand This change adds a test for the creation, opening, and closing of a hidden subvolume. In order to support that in a non-interactive fashion, we introduce and honor the NITROCLI_PASSWORD environment variable, that prevents an interactive password query. --- nitrocli/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nitrocli/src/main.rs') diff --git a/nitrocli/src/main.rs b/nitrocli/src/main.rs index ff6db0f..58d0628 100644 --- a/nitrocli/src/main.rs +++ b/nitrocli/src/main.rs @@ -102,6 +102,7 @@ const NITROCLI_ADMIN_PIN: &str = "NITROCLI_ADMIN_PIN"; const NITROCLI_USER_PIN: &str = "NITROCLI_USER_PIN"; const NITROCLI_NEW_ADMIN_PIN: &str = "NITROCLI_NEW_ADMIN_PIN"; const NITROCLI_NEW_USER_PIN: &str = "NITROCLI_NEW_USER_PIN"; +const NITROCLI_PASSWORD: &str = "NITROCLI_PASSWORD"; /// The context used when running the program. pub(crate) struct RunCtx<'io> { @@ -121,6 +122,8 @@ pub(crate) struct RunCtx<'io> { /// /// This variable is only used by commands that change the user PIN. pub new_user_pin: Option, + /// A password used by some commands, if provided through an environment variable. + pub password: Option, } fn run<'ctx, 'io: 'ctx>(ctx: &'ctx mut RunCtx<'io>, args: Vec) -> i32 { @@ -154,6 +157,7 @@ fn main() { user_pin: env::var_os(NITROCLI_USER_PIN), new_admin_pin: env::var_os(NITROCLI_NEW_ADMIN_PIN), new_user_pin: env::var_os(NITROCLI_NEW_USER_PIN), + password: env::var_os(NITROCLI_PASSWORD), }; let rc = run(ctx, args); -- cgit v1.2.1