1use std::path::PathBuf;
2
3use clap::{Args, Parser, Subcommand, ValueEnum};
4
5#[derive(Parser)]
6#[command(name = "callisto", version)]
7pub struct Cli {
8 #[command(flatten)]
9 pub global: GlobalArgs,
10 #[command(subcommand)]
11 pub command: Command,
12}
13
14#[derive(Args, Clone, Debug)]
15pub struct GlobalArgs {
16 #[arg(long, global = true, value_enum, default_value = "text")]
17 pub format: OutputFormat,
18
19 #[arg(long, global = true, default_value = ".")]
20 pub cwd: PathBuf,
21
22 #[arg(
23 long,
24 global = true,
25 help = "Preview manifest and file changes without writing to disk"
26 )]
27 pub dry_run: bool,
28}
29
30#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)]
31pub enum OutputFormat {
32 Text,
33 Json,
34}
35
36#[derive(Subcommand, Clone, Debug)]
37pub enum Command {
38 Add(AddArgs),
39 Status(StatusArgs),
40 Version(VersionArgs),
41 #[command(subcommand)]
42 Pre(PreArgs),
43 Validate(ValidateArgs),
44 Snapshot(SnapshotArgs),
45 Init(InitArgs),
46 PlanPublish(PlanPublishArgs),
47 ComposePrBody(ComposePrBodyArgs),
48 Tag(TagArgs),
49 Completions(CompletionsArgs),
50 Schema(SchemaArgs),
51}
52
53#[derive(Args, Clone, Debug, Default)]
54pub struct SchemaArgs {
55 #[arg(long = "type", value_name = "TYPE")]
56 pub target_type: Option<String>,
57}
58
59#[derive(Args, Clone, Debug)]
60pub struct AddArgs {
61 #[arg(long = "package", value_name = "NAME:SEVERITY")]
62 pub packages: Vec<String>,
63 #[arg(long)]
64 pub summary: Option<String>,
65}
66
67#[derive(Args, Clone, Debug)]
68pub struct StatusArgs {
69 #[arg(long)]
70 pub strict: bool,
71 #[arg(long)]
72 pub strict_graph: bool,
73 #[arg(long)]
74 pub check: bool,
75}
76
77#[derive(Args, Clone, Debug)]
78pub struct VersionArgs {
79 #[arg(long)]
80 pub refresh_lockfiles: bool,
81 #[arg(long)]
82 pub strict: bool,
83 #[arg(long)]
84 pub strict_graph: bool,
85 #[arg(long)]
86 pub allow_empty_changesets: bool,
87}
88
89#[derive(Subcommand, Clone, Debug)]
90pub enum PreArgs {
91 Enter { tag: String },
92 Exit,
93}
94
95#[derive(Args, Clone, Debug)]
96pub struct ValidateArgs {
97 #[arg(long)]
98 pub staged: bool,
99 #[arg(long, value_name = "REF", conflicts_with = "staged")]
100 pub since: Option<String>,
101 #[arg(long)]
102 pub strict: bool,
103 #[arg(long)]
104 pub strict_graph: bool,
105}
106
107#[derive(Args, Clone, Debug)]
108pub struct SnapshotArgs {
109 #[arg(long)]
110 pub tag: String,
111}
112
113#[derive(Args, Clone, Debug)]
114pub struct InitArgs {
115 #[arg(long)]
116 pub yes: bool,
117}
118
119#[derive(Args, Clone, Debug, Default)]
120pub struct PlanPublishArgs {}
121
122#[derive(Args, Clone, Debug)]
123pub struct ComposePrBodyArgs {
124 #[arg(long, value_name = "TEXT|-")]
125 pub existing_body: Option<String>,
126 #[arg(long = "label")]
127 pub labels: Vec<String>,
128 #[arg(long)]
129 pub branch: Option<String>,
130}
131
132#[derive(Args, Clone, Debug)]
133pub struct TagArgs {
134 #[arg(long, value_name = "FILE|-")]
135 pub plan: String,
136 #[arg(long)]
137 pub floating_major: bool,
138}
139
140#[derive(Args, Clone, Debug)]
141pub struct CompletionsArgs {
142 #[arg(value_enum)]
143 pub shell: clap_complete::Shell,
144}