Skip to main content

robin/cli/
commands.rs

1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(author, version, about)]
5pub struct Cli {
6    #[command(subcommand)]
7    pub command: Option<Commands>,
8
9    /// List all available commands
10    #[arg(short, long)]
11    pub list: bool,
12
13    /// Interactive mode
14    #[arg(short, long)]
15    pub interactive: bool,
16
17    /// Send system notification when command completes
18    #[arg(long)]
19    pub notify: bool,
20
21    /// Print the fully-resolved command(s) without executing anything
22    #[arg(long)]
23    pub dry_run: bool,
24
25    /// Run the task's commands in this directory instead of the current one
26    #[arg(long, value_name = "DIR")]
27    pub cwd: Option<std::path::PathBuf>,
28}
29
30#[derive(Subcommand)]
31pub enum Commands {
32    /// Initialize a new .robin.json file
33    Init {
34        /// Template to use (android, ios, flutter, rails, node, nextjs, python, rust, go)
35        #[arg(long)]
36        template: Option<String>,
37    },
38
39    /// Add a new command
40    Add {
41        /// Command name
42        name: String,
43        /// Command script
44        script: String,
45    },
46
47    /// Remove a command
48    #[command(alias = "rm")]
49    Remove {
50        /// Command name to remove
51        name: String,
52    },
53
54    /// Rename a command
55    Rename {
56        /// Current command name
57        from: String,
58        /// New command name
59        to: String,
60    },
61
62    /// Rewrite .robin.json so every task uses the object form with a `desc`
63    /// field ready to be filled in (existing string/array tasks keep working)
64    Migrate,
65
66    /// Check development environment setup
67    Doctor,
68
69    /// Update development tools to their latest versions
70    DoctorUpdate,
71
72    /// Run a script
73    #[command(external_subcommand)]
74    Run(Vec<String>),
75}