cargo_packager/cli/signer/
mod.rs

1// Copyright 2023-2023 CrabNebula Ltd.
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5use clap::{Parser, Subcommand};
6
7use super::Result;
8
9mod generate;
10mod sign;
11
12#[derive(Debug, Clone, Subcommand)]
13enum Commands {
14    Sign(sign::Options),
15    Generate(generate::Options),
16}
17
18#[derive(Debug, Clone, Parser)]
19#[clap(about = "Sign a file or generate a new signing key to sign files")]
20pub struct Options {
21    #[command(subcommand)]
22    command: Commands,
23}
24
25pub fn command(options: Options) -> Result<()> {
26    match options.command {
27        Commands::Sign(opts) => sign::command(opts),
28        Commands::Generate(opts) => generate::command(opts),
29    }
30}