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}
52
53#[derive(Debug, Args)]
54pub struct MigrationListArgs {
55 pub path: Option<PathBuf>,
58}
59
60#[derive(Debug, Args)]
61pub struct MigrationMakeArgs {
62 pub path: Option<PathBuf>,
65 #[arg(long)]
67 pub app_name: Option<String>,
68 #[arg(long)]
71 pub output_dir: Option<PathBuf>,
72}
73
74#[derive(Debug, Args)]
75#[group(multiple = false)]
76pub struct CotSourceArgs {
77 #[arg(long, group = "cot_source")]
79 pub use_git: bool,
80 #[arg(long, group = "cot_source")]
82 pub cot_path: Option<PathBuf>,
83}
84
85#[derive(Debug, Subcommand)]
86pub enum CliCommands {
87 Manpages(ManpagesArgs),
89 Completions(CompletionsArgs),
91}
92
93#[derive(Debug, Args)]
94pub struct ManpagesArgs {
95 #[arg(short, long)]
97 pub output_dir: Option<PathBuf>,
98 #[arg(short, long)]
100 pub create: bool,
101}
102
103#[derive(Debug, Clone, Copy, Args)]
104pub struct CompletionsArgs {
105 pub shell: clap_complete::Shell,
107}