heddle_cli_args/cli/cli_args/
commands_review.rs1use clap::{Args, Subcommand, ValueEnum};
5
6use super::DiffBaseArg;
7
8#[derive(Clone, Debug, Subcommand)]
9pub enum ReviewCommands {
10 Show(ReviewShowArgs),
12 Sign(ReviewSignArgs),
14 Next(ReviewNextArgs),
16 Health(ReviewHealthArgs),
18}
19
20#[derive(Clone, Debug, Args)]
21pub struct ReviewShowArgs {
22 pub state: Option<String>,
24 #[arg(long, value_enum)]
27 pub base: Option<DiffBaseArg>,
28 #[arg(long)]
30 pub all_signals: bool,
31}
32
33#[derive(Clone, Debug, Args)]
34pub struct ReviewSignArgs {
35 pub state: String,
36 #[arg(long, value_enum)]
38 pub kind: SignKindArg,
39 #[arg(long)]
41 pub justification: Option<String>,
42 #[arg(long)]
45 pub symbols: Vec<String>,
46 #[arg(long, default_value = "ed25519")]
48 pub algorithm: String,
49 #[arg(long)]
51 pub public_key: String,
52 #[arg(long)]
54 pub signature: String,
55 #[arg(long)]
59 pub signed_at_unix: i64,
60}
61
62#[derive(Clone, Debug, ValueEnum)]
63pub enum SignKindArg {
64 Read,
65 AgentPreview,
66 AgentCoReview,
67}
68
69impl SignKindArg {
70 pub fn as_wire(&self) -> &'static str {
71 match self {
72 Self::Read => "read",
73 Self::AgentPreview => "agent_preview",
74 Self::AgentCoReview => "agent_co_review",
75 }
76 }
77
78 pub fn as_proto(&self) -> api::heddle::api::v1alpha1::ReviewKind {
79 use api::heddle::api::v1alpha1::ReviewKind;
80 match self {
81 Self::Read => ReviewKind::Read,
82 Self::AgentPreview => ReviewKind::AgentPreview,
83 Self::AgentCoReview => ReviewKind::AgentCoReview,
84 }
85 }
86}
87
88#[derive(Clone, Debug, Args)]
89pub struct ReviewNextArgs {
90 #[arg(long)]
92 pub mine_only: bool,
93 #[arg(long)]
95 pub kind: Option<String>,
96}
97
98#[derive(Clone, Debug, Args)]
99pub struct ReviewHealthArgs {
100 #[arg(long)]
103 pub window: Option<u32>,
104}