-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.rs
More file actions
58 lines (46 loc) · 1.65 KB
/
cli.rs
File metadata and controls
58 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use clap::{Args, Parser, Subcommand};
/// A cross-platform task runner with zero setup
#[derive(Parser, Debug)]
#[command(name = "rnr")]
#[command(author, version, about, long_about = None)]
pub struct Cli {
/// Task to run
#[arg(value_name = "TASK")]
pub task: Option<String>,
/// List all available tasks
#[arg(short, long)]
pub list: bool,
#[command(subcommand)]
pub command: Option<Command>,
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Initialize rnr in the current directory
Init(InitArgs),
/// Upgrade rnr binaries to the latest version
Upgrade,
}
#[derive(Args, Debug)]
pub struct InitArgs {
/// Comma-separated list of platforms (e.g., linux-amd64,macos-arm64,windows-amd64)
#[arg(long, value_delimiter = ',')]
pub platforms: Option<Vec<String>>,
/// Include all available platforms
#[arg(long, conflicts_with_all = ["platforms", "current_platform_only"])]
pub all_platforms: bool,
/// Only include the current platform
#[arg(long, conflicts_with_all = ["platforms", "all_platforms"])]
pub current_platform_only: bool,
/// Add a platform to existing setup
#[arg(long, conflicts_with_all = ["platforms", "all_platforms", "current_platform_only", "remove_platform"])]
pub add_platform: Option<String>,
/// Remove a platform from existing setup
#[arg(long, conflicts_with_all = ["platforms", "all_platforms", "current_platform_only", "add_platform"])]
pub remove_platform: Option<String>,
/// Show currently configured platforms
#[arg(long)]
pub show_platforms: bool,
/// Skip git repository root check
#[arg(long)]
pub force: bool,
}