suitcase/internal/
cli.rs

1use crate::internal;
2use clap::{Args, Parser, Subcommand};
3
4/// A set of personal CLI tools to automate common tasks in software development
5/// (including Rust, Dart, and Flutter), written in Rust.
6#[derive(Parser)]
7#[clap(author, version, about, long_about = None)]
8#[clap(propagate_version = true)]
9pub struct Cli {
10    #[clap(subcommand)]
11    /// The command to run.
12    pub command: Command,
13
14    /// Base arguments that are shared across all subcommands.
15    #[clap(flatten)]
16    pub base_args: BaseArgs,
17}
18
19/// A single suitcase subcommand to run.
20#[derive(Subcommand)]
21pub enum Command {
22    /// Open the current directory's Git repository in the default browser.
23    ///
24    /// Optionally provide a path to open a specific directory's repository
25    /// other than the current directory.
26    ///
27    /// Command name is short for "github open"
28    #[clap(name = "gho")]
29    GitHubOpen(internal::commands::gho::GitHubOpenOptions),
30
31    /// Upgrade suitcase to the latest version from cargo or from a local path.
32    ///
33    /// This command will download and install the latest version of suitcase
34    /// from crates.io, or from a local path if it was installed from source.
35    #[clap(name = "upgrade")]
36    Upgrade(internal::commands::upgrade::UpgradeOptions),
37
38    /// Run the given command for every Dart project in the current directory
39    /// and its subdirectories recursively.
40    ///
41    /// Command name is short for "for dart"
42    #[clap(name = "ford")]
43    ForEveryDartProject(internal::commands::ford::ForEveryDartProjectOptions),
44
45    /// Set the FVM version for every Flutter or Dart project in the current directory
46    /// and its subdirectories recursively.
47    ///
48    /// Command name is short for "flutter use all"
49    #[clap(name = "fua")]
50    FvmUseForEveryFlutterProject(internal::commands::fua::FvmUseForEveryFlutterProjectOptions),
51}
52
53/// Base arguments that are shared across all subcommands.
54#[derive(Clone, Args)]
55pub struct BaseArgs {
56    /// Print verbose output. Cannot be used in combination with `--quiet`.
57    #[clap(short, long, global = true)]
58    pub verbose: bool,
59
60    /// Print no output. Cannot be used in combination with `--verbose`.
61    #[clap(short, long, global = true)]
62    pub quiet: bool,
63}