Skip to main content

tix/cli/
cli_capacity.rs

1#[allow(clippy::wildcard_imports)]
2use super::*;
3
4#[derive(Debug, Clone, Subcommand)]
5pub enum CapacityCommand {
6    /// List every configured ceiling, one tab-separated row per entry
7    ///
8    /// Columns: `id`, `scope`, `reference`, `display`, `capacity`, `unit`,
9    /// `enabled`. The header prints even with no entries, so an empty section is
10    /// visibly empty rather than indistinguishable from a failure.
11    List,
12    /// Show one ceiling by the reference it names
13    ///
14    /// A reference is a cycle's name or stable id, a team label, or an assignee
15    /// identity; `--scope` narrows it when one reference names two scopes.
16    Show {
17        /// Cycle name/stable id, team label, or assignee identity
18        #[arg(value_name = "REFERENCE")]
19        reference: String,
20        /// Restrict the match to one scope: `cycle`, `team` or `assignee`
21        #[arg(long, value_name = "SCOPE")]
22        scope: Option<String>,
23    },
24    /// Set one scope's ceiling; validated before persistence
25    ///
26    /// The scope and the unit are explicit: a value with no unit, a unit no board
27    /// declares, an unknown cycle/team, or a second ceiling for one scope is
28    /// refused before `tix.toml` changes.
29    Set {
30        /// Scope dimension: `cycle`, `team` or `assignee`
31        #[arg(long, value_name = "SCOPE")]
32        scope: String,
33        /// The scope's reference (a cycle name or stable id, a team label, an identity)
34        #[arg(long, value_name = "ID")]
35        id: String,
36        /// The ceiling, in `--unit`, at or above zero
37        ///
38        /// A negative value is accepted by the parser and refused by the shared
39        /// validator with its field path (`capacity.<id>.capacity`), which is a better
40        /// message than clap's "unexpected argument".
41        #[arg(long, value_name = "N", allow_hyphen_values = true)]
42        value: i64,
43        /// The estimate unit the ceiling counts in (declared by the active board)
44        #[arg(long, value_name = "UNIT")]
45        unit: String,
46        /// Keep the value and the unit, but enforce nothing
47        #[arg(long)]
48        disabled: bool,
49    },
50    /// Delete one scope's ceiling
51    Delete {
52        /// Scope dimension: `cycle`, `team` or `assignee`
53        #[arg(long, value_name = "SCOPE")]
54        scope: String,
55        /// The scope's reference (a cycle name or stable id, a team label, an identity)
56        #[arg(long, value_name = "ID")]
57        id: String,
58    },
59    /// Calculate one scope's committed/completed/remaining/overflow/utilization
60    ///
61    /// Every value comes from the shared calculation DTO; a value the calculation
62    /// could not derive prints as `-`, never as a zero. Findings go to stderr.
63    Calculate {
64        /// Scope dimension: `cycle`, `team` or `assignee`
65        #[arg(long, value_name = "SCOPE")]
66        scope: String,
67        /// The scope's reference (a cycle name or stable id, a team label, an identity)
68        #[arg(long, value_name = "ID")]
69        id: String,
70        /// Also render the overflow report (estimate and reference findings always render)
71        #[arg(long)]
72        warnings: bool,
73    },
74    /// Read back a closed cycle's immutable capacity evidence
75    Snapshot {
76        /// Cycle name or stable `<schedule-id>:<sequence>` id
77        #[arg(value_name = "CYCLE")]
78        cycle: String,
79        /// Also render the overflow finding the close recorded
80        #[arg(long)]
81        warnings: bool,
82    },
83}