nethsm_cli/cli/
unlock.rs

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