signstar_request_signature/
cli.rs

1//! Command line interface.
2
3use std::path::PathBuf;
4
5use clap::Parser;
6use clap_verbosity_flag::Verbosity;
7
8/// Command line arguments for signing.
9#[derive(Debug, Parser)]
10pub struct Cli {
11    /// Global processing log verbosity.
12    #[command(flatten)]
13    pub verbosity: Verbosity,
14
15    /// Command to be executed.
16    #[command(subcommand)]
17    pub command: Command,
18}
19
20/// Command line arguments for signing.
21#[derive(Debug, Parser)]
22pub enum Command {
23    /// Prepare signing request for a file.
24    Prepare(PrepareCommand),
25
26    /// Send signing request over SSH.
27    Send(SendCommand),
28}
29
30/// Signing request input parameters.
31#[derive(Debug, Parser)]
32pub struct PrepareCommand {
33    /// The path to a file being signed
34    #[arg(env = "SIGNSTAR_REQUEST_FILE")]
35    pub input: PathBuf,
36}
37
38/// Sending signing request input parameters.
39#[derive(Debug, Parser)]
40pub struct SendCommand {
41    /// Signstar host.
42    #[arg(long)]
43    pub host: String,
44
45    /// Signstar port.
46    #[clap(default_value_t = 22)]
47    #[arg(long)]
48    pub port: u16,
49
50    /// Signstar user.
51    #[arg(long)]
52    pub user: String,
53
54    /// Path to the agent socket used for user authentication.
55    #[arg(long)]
56    pub agent_socket: PathBuf,
57
58    /// Public key of a user.
59    #[arg(long)]
60    pub user_public_key: String,
61
62    /// Path of a known hosts file which contains public keys of the serevr.
63    #[arg(long)]
64    pub known_hosts: PathBuf,
65
66    /// The path to a file being signed
67    #[arg(env = "SIGNSTAR_REQUEST_FILE")]
68    pub input: PathBuf,
69}