vdev/commands/check/
component_docs.rs1use crate::git;
2use anyhow::{Ok, Result};
3
4#[derive(clap::Args, Debug)]
6#[command()]
7pub struct Cli {}
8
9impl Cli {
10 pub fn exec(self) -> Result<()> {
11 let files: Vec<String> = git::get_modified_files()?;
12 let dirty_component_files: Vec<String> = files
13 .into_iter()
14 .filter(|file| file.starts_with("website/cue/reference"))
15 .filter(|file| file.contains("generated/"))
16 .collect();
17
18 if !dirty_component_files.is_empty() {
20 println!("Found out-of-sync component Cue files in this branch:");
21 for file in dirty_component_files {
22 println!(" - {file}");
23 }
24 println!(
25 "Run `make generate-component-docs` locally to update your branch and commit/push the changes."
26 );
27 std::process::exit(1);
28 }
29
30 Ok(())
31 }
32}