crank/
cli.rs

1//! CLI argument definitions using clap
2
3use clap::{Parser, Subcommand};
4
5#[derive(Parser)]
6#[command(name = "crank")]
7#[command(author, version, about, long_about = None)]
8#[command(
9    about = "crank - A build tool for Playdate game development",
10    long_about = "crank is a command-line build tool for Playdate game development, \
11                  inspired by Cargo. It provides project scaffolding, build automation, \
12                  and development tools to streamline your workflow."
13)]
14pub struct Cli {
15    #[command(subcommand)]
16    pub command: Commands,
17}
18
19#[derive(Subcommand)]
20pub enum Commands {
21    /// Create a new Playdate project
22    #[command(visible_alias = "n")]
23    New {
24        /// Name of the project
25        name: String,
26
27        /// Path where the project will be created (defaults to current directory)
28        path: Option<String>,
29
30        /// Project template to use
31        #[arg(short, long, default_value = "lua-basic")]
32        template: Option<String>,
33    },
34
35    /// Build the current project
36    #[command(visible_alias = "b")]
37    Build {
38        /// Build in release mode with optimizations
39        #[arg(short, long)]
40        release: bool,
41
42        /// Show detailed build output
43        #[arg(short, long)]
44        verbose: bool,
45    },
46
47    /// Build and run the project in the Playdate Simulator
48    #[command(visible_alias = "r")]
49    Run {
50        /// Run release build
51        #[arg(short, long)]
52        release: bool,
53    },
54
55    /// Watch for changes and rebuild automatically
56    #[command(visible_alias = "w")]
57    Watch {
58        /// Don't launch simulator, just rebuild on changes
59        #[arg(long)]
60        no_run: bool,
61    },
62
63    /// Run tests
64    #[command(visible_alias = "t")]
65    Test {
66        /// Filter tests by pattern
67        #[arg(short, long)]
68        filter: Option<String>,
69    },
70
71    /// Clean build artifacts
72    #[command(visible_alias = "c")]
73    Clean,
74}