vdev/commands/check/
markdown.rs

1use anyhow::Result;
2
3use crate::app;
4use crate::git::git_ls_files;
5
6/// Check that markdown is styled properly
7#[derive(clap::Args, Debug)]
8#[command()]
9pub struct Cli {}
10
11impl Cli {
12    pub fn exec(self) -> Result<()> {
13        let files = git_ls_files(Some("*.md"))?;
14        if files.is_empty() {
15            return Ok(());
16        }
17
18        let args: Vec<&str> = vec![
19            "--config",
20            "scripts/.markdownlintrc",
21            // We should fix these as well. Previously these files were not linted.
22            "--ignore",
23            ".github"
24        ]
25            .into_iter()
26            .chain(files.iter().map(String::as_str))
27            .collect();
28
29        app::exec("markdownlint", &args, true)
30    }
31}