nethsm_cli/cli/
random.rs

1use std::path::PathBuf;
2
3use clap::Parser;
4use expression_format::ex_format;
5use nethsm::UserRole::Operator;
6
7#[derive(Debug, Parser)]
8#[command(
9    about = "Get random bytes from a device",
10    long_about = ex_format!("Get random bytes from a device
11
12Unless a specific output file is chosen, writes a given number of random bytes to stdout.
13
14Requires authentication of a user in the \"{Operator}\" role.")
15)]
16pub struct RandomCommand {
17    #[arg(
18        env = "NETHSM_RANDOM_LENGTH",
19        help = "The number of random bytes to return"
20    )]
21    pub length: u32,
22    #[arg(
23        env = "NETHSM_FORCE",
24        help = "Write to output file even if it exists already",
25        long,
26        short
27    )]
28    pub force: bool,
29
30    #[arg(
31        env = "NETHSM_RANDOM_OUTPUT_FILE",
32        help = "The optional path to a specific output file",
33        long,
34        short
35    )]
36    pub output: Option<PathBuf>,
37}