Skip to main content

spec_driven_docs/cli/
lint.rs

1//! `lint` subcommand: parse-shape.
2//!
3//! Holds the clap derive structs only. No I/O, no business logic.
4
5use camino::Utf8PathBuf;
6
7use crate::domain::profile::ProfileId;
8
9/// Report what the Markdown linter will read, or prove its link rule runs.
10#[derive(Debug, clap::Args)]
11pub struct LintArgs {
12    /// What to do. The report is the default.
13    #[command(subcommand)]
14    pub command: Option<LintCommand>,
15
16    /// The repository to read; absolute, or the working directory.
17    #[arg(long, default_value = ".")]
18    pub target: Utf8PathBuf,
19
20    /// The candidate profile to read before a landing; an instance reads
21    /// its recorded profile, which a different value refuses.
22    #[arg(long, value_enum)]
23    pub profile: Option<ProfileId>,
24
25    /// Print one JSON object instead of text.
26    #[arg(long)]
27    pub json: bool,
28}
29
30/// The verbs `sdd lint` offers beyond the report.
31#[derive(Debug, clap::Subcommand)]
32pub enum LintCommand {
33    /// Prove the relative-links rule fires: lint a broken link, then a valid
34    /// one, through the delivered hook, and remove the scratch file.
35    Prove(LintProveArgs),
36}
37
38/// Prove the relative-links rule fires.
39#[derive(Debug, clap::Args)]
40pub struct LintProveArgs {
41    /// The repository to prove; absolute, or the working directory.
42    #[arg(long, default_value = ".")]
43    pub target: Utf8PathBuf,
44
45    /// Print one JSON object instead of text.
46    #[arg(long)]
47    pub json: bool,
48}