cli.rs (1428B)
1 use std::path::PathBuf; 2 3 use clap::{Args as ClapArgs, Parser, Subcommand}; 4 use radroots_runtime::RadrootsServiceCliArgs; 5 6 #[derive(Parser, Debug, Clone)] 7 #[command( 8 about = env!("CARGO_PKG_DESCRIPTION"), 9 author = env!("CARGO_PKG_AUTHORS"), 10 version = env!("CARGO_PKG_VERSION") 11 )] 12 pub struct Args { 13 #[command(flatten)] 14 pub service: RadrootsServiceCliArgs, 15 #[command(subcommand)] 16 pub command: Option<Command>, 17 } 18 19 #[derive(Subcommand, Debug, Clone)] 20 pub enum Command { 21 PublishProxy(PublishProxyCommand), 22 } 23 24 #[derive(ClapArgs, Debug, Clone)] 25 pub struct PublishProxyCommand { 26 #[command(subcommand)] 27 pub command: PublishProxySubcommand, 28 } 29 30 #[derive(Subcommand, Debug, Clone)] 31 pub enum PublishProxySubcommand { 32 Principal(PrincipalCommand), 33 } 34 35 #[derive(ClapArgs, Debug, Clone)] 36 pub struct PrincipalCommand { 37 #[command(subcommand)] 38 pub command: PrincipalSubcommand, 39 } 40 41 #[derive(Subcommand, Debug, Clone)] 42 pub enum PrincipalSubcommand { 43 Init(PrincipalInitArgs), 44 } 45 46 #[derive(ClapArgs, Debug, Clone)] 47 pub struct PrincipalInitArgs { 48 #[arg(long)] 49 pub label: String, 50 #[arg(long)] 51 pub token_file: PathBuf, 52 #[arg(long)] 53 pub allowed_pubkey: Vec<String>, 54 #[arg(long)] 55 pub allowed_kind: Vec<u32>, 56 #[arg(long)] 57 pub allowed_relay_policy: Vec<String>, 58 #[arg(long)] 59 pub job_visibility: String, 60 #[arg(long)] 61 pub allow_request_relays: bool, 62 }