Skip to main content

nethsm/cli/command/
unlock.rs

1use clap::Parser;
2use expression_format::ex_format;
3
4use crate::{SystemState::Locked, UserRole::Administrator, cli::PassphraseFile};
5
6/// The "nethsm unlock" command.
7#[derive(Debug, Parser)]
8#[command(
9    about = "Unlock a device",
10    long_about = ex_format!("Unlock a device using the unlock passphrase
11
12The device must be in state \"{Locked}\".
13
14If no passphrase is provided it is prompted for interactively.
15
16Requires authentication of a user in the \"{Administrator}\" role."),
17)]
18pub struct UnlockCommand {
19    /// The optional path to a file containing the unlock passphrase.
20    #[arg(
21        env = "NETHSM_UNLOCK_PASSPHRASE_FILE",
22        help = "The path to a file containing the unlock passphrase",
23        long_help = "The path to a file containing the unlock passphrase
24
25The passphrase must be >= 10 and <= 200 characters long.",
26        long,
27        short = 'U'
28    )]
29    pub unlock_passphrase_file: Option<PassphraseFile>,
30}