Skip to main content

harmont_cli/cli/
run.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4// RunArgs uses several bool flags (no_watch, logs, cloud): each is an
5// independent clap switch and a state-machine or enum would be more confusing.
6#[allow(clippy::struct_excessive_bools)]
7#[derive(Debug, Clone, Parser)]
8pub struct RunArgs {
9    /// Pipeline slug. Required when the repo declares more than one
10    /// `@hm.pipeline`; the CLI lists available slugs when omitted.
11    #[arg()]
12    pub pipeline: Option<String>,
13
14    /// Branch to record on the build.
15    #[arg(short, long)]
16    pub branch: Option<String>,
17
18    /// Build message.
19    #[arg(short, long)]
20    pub message: Option<String>,
21
22    /// Environment variables (KEY=VALUE).
23    #[arg(short, long)]
24    pub env: Vec<String>,
25
26    /// Source root (defaults to cwd).
27    #[arg(short, long)]
28    pub dir: Option<PathBuf>,
29
30    /// Skip watching the build after it's created.
31    #[arg(long)]
32    pub no_watch: bool,
33
34    /// Maximum number of chains to run concurrently. Defaults to the
35    /// host's available parallelism. `0` is treated as `1`.
36    #[arg(long, value_name = "N")]
37    pub parallelism: Option<usize>,
38
39    /// Continue running independent pipeline branches after a step
40    /// failure. Dependent steps are still skipped, but unrelated chains
41    /// proceed so you see all failures in one run.
42    #[arg(short = 'k', long)]
43    pub keep_going: bool,
44
45    /// Output formatter (matches an installed output-formatter plugin
46    /// `name`). Built-ins: `human`, `json`. Default: `human`.
47    #[arg(long, value_name = "NAME", default_value = "human", global = false)]
48    pub format: String,
49
50    /// Stream full build logs instead of showing progress bars.
51    /// Has no effect with `--format json`.
52    #[arg(long)]
53    pub logs: bool,
54
55    /// Execution backend. `docker` (default) runs the build locally on the
56    /// Docker VM backend; `cloud` submits it to Harmont Cloud and streams
57    /// live logs. Layers over the `backend` config key when omitted.
58    #[arg(long, value_name = "NAME")]
59    pub backend: Option<String>,
60
61    /// Deprecated alias for `--backend cloud`. Uploads the working tree
62    /// (respecting .gitignore, excluding .git) and streams live logs.
63    #[arg(long, hide = true)]
64    pub cloud: bool,
65
66    /// Cloud organization (defaults to the configured default org or
67    /// `[cloud] org` in config). Used when the backend resolves to cloud.
68    #[arg(long)]
69    pub org: Option<String>,
70}