vdev/commands/check/
generated_docs.rs1use crate::utils::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| {
16 file.contains("generated/")
17 || file.starts_with("website/cue/reference/remap/functions/")
18 })
19 .collect();
20
21 if !dirty_component_files.is_empty() {
23 println!("Found out-of-sync component Cue files in this branch:");
24 for file in dirty_component_files {
25 println!(" - {file}");
26 }
27 println!(
28 "Run `make generate-docs` locally to update your branch and commit/push the changes."
29 );
30 std::process::exit(1);
31 }
32
33 Ok(())
34 }
35}