auths_cli/commands/
approval.rs1use anyhow::Result;
4use clap::{Parser, Subcommand};
5
6use crate::commands::executable::ExecutableCommand;
7use crate::config::CliConfig;
8
9pub const EXIT_APPROVAL_REQUIRED: i32 = 75;
12
13#[derive(Parser, Debug)]
14#[command(about = "Manage approval gates")]
15pub struct ApprovalCommand {
16 #[command(subcommand)]
17 pub command: ApprovalSubcommand,
18}
19
20#[derive(Subcommand, Debug)]
21pub enum ApprovalSubcommand {
22 List(ApprovalListCommand),
24 Grant(ApprovalGrantCommand),
26}
27
28#[derive(Parser, Debug)]
29pub struct ApprovalListCommand {}
30
31#[derive(Parser, Debug)]
32pub struct ApprovalGrantCommand {
33 #[arg(long)]
35 pub request: String,
36 #[arg(long)]
38 pub note: Option<String>,
39}
40
41impl ExecutableCommand for ApprovalCommand {
42 fn execute(&self, _ctx: &CliConfig) -> Result<()> {
43 match &self.command {
44 ApprovalSubcommand::List(_cmd) => {
45 println!("No pending approval requests.");
46 Ok(())
47 }
48 ApprovalSubcommand::Grant(cmd) => {
49 println!(
50 "Approval grant for request {} — not yet wired to storage backend.",
51 cmd.request
52 );
53 Ok(())
54 }
55 }
56 }
57}