1use std::path::PathBuf;
2
3use clap::{Args, Parser, Subcommand};
4use clap_verbosity_flag::Verbosity;
5
6#[derive(Debug, Parser)]
7#[command(
8 name = "cot",
9 version,
10 about,
11 long_about = None
12)]
13pub struct Cli {
14 #[command(flatten)]
15 pub verbose: Verbosity,
16 #[command(subcommand)]
17 pub command: Commands,
18}
19
20#[derive(Debug, Subcommand)]
21pub enum Commands {
22 New(ProjectNewArgs),
24
25 #[command(subcommand)]
27 Migration(MigrationCommands),
28
29 #[command(subcommand)]
31 Cli(CliCommands),
32}
33
34#[derive(Debug, Args)]
35pub struct ProjectNewArgs {
36 pub path: PathBuf,
38 #[arg(long)]
40 pub name: Option<String>,
41 #[command(flatten)]
42 pub source: CotSourceArgs,
43}
44
45#[derive(Debug, Subcommand)]
46pub enum MigrationCommands {
47 List(MigrationListArgs),
49 Make(MigrationMakeArgs),
51 New(MigrationNewArgs),
53}
54
55#[derive(Debug, Args)]
56pub struct MigrationNewArgs {
57 pub name: String,
59 pub path: Option<PathBuf>,
62 #[arg(long)]
64 pub app_name: Option<String>,
65}
66
67#[derive(Debug, Args)]
68pub struct MigrationListArgs {
69 pub path: Option<PathBuf>,
72}
73
74#[derive(Debug, Args)]
75pub struct MigrationMakeArgs {
76 pub path: Option<PathBuf>,
79 #[arg(long)]
81 pub app_name: Option<String>,
82 #[arg(long)]
85 pub output_dir: Option<PathBuf>,
86}
87
88#[derive(Debug, Args)]
89#[group(multiple = false)]
90pub struct CotSourceArgs {
91 #[arg(long, group = "cot_source")]
93 pub use_git: bool,
94 #[arg(long, group = "cot_source")]
96 pub cot_path: Option<PathBuf>,
97}
98
99#[derive(Debug, Subcommand)]
100pub enum CliCommands {
101 Manpages(ManpagesArgs),
103 Completions(CompletionsArgs),
105}
106
107#[derive(Debug, Args)]
108pub struct ManpagesArgs {
109 #[arg(short, long)]
111 pub output_dir: Option<PathBuf>,
112 #[arg(short, long)]
114 pub create: bool,
115}
116
117#[derive(Debug, Clone, Copy, Args)]
118pub struct CompletionsArgs {
119 pub shell: clap_complete::Shell,
121}