Skip to main content

spec_driven_docs/cli/
hooks.rs

1//! `hooks` subcommand: parse-shape.
2//!
3//! Holds the clap derive struct only. No I/O, no business logic.
4
5/// Render the delivered gate set as the managed pre-commit block.
6#[derive(Debug, clap::Args)]
7pub struct HooksArgs {
8    /// What replaces `{docs_root}` in wiring patterns.
9    ///
10    /// Omitted, the target's recorded documentation root is used where the
11    /// target is an instance, and `_docs` otherwise. A block rendered
12    /// against the wrong root would disagree with the one the installer
13    /// wrote.
14    #[arg(long)]
15    pub docs_root: Option<String>,
16
17    /// The command prefix every entry invokes.
18    #[arg(long, default_value = "sdd")]
19    pub entry: String,
20
21    /// The sequence-item indentation of the consumer's repos entries.
22    #[arg(long, default_value = "  ")]
23    pub indent: String,
24
25    /// The instance whose declaration the block is rendered from.
26    #[arg(long, default_value = ".")]
27    pub target: String,
28
29    /// Write the rendered block into the target's `.pre-commit-config.yaml`,
30    /// replacing the managed region.
31    ///
32    /// Run this after editing the declaration. It works at the same version,
33    /// which `sdd upgrade` does not.
34    #[arg(long, conflicts_with = "check")]
35    pub apply: bool,
36
37    /// Exit non-zero when the target's managed region does not match what
38    /// the declaration renders.
39    #[arg(long)]
40    pub check: bool,
41}