vdev/commands/check/
scripts.rs

1use anyhow::Result;
2
3use crate::{app, git};
4
5/// Check that shell scripts do not have common mistakes
6#[derive(clap::Args, Debug)]
7#[command()]
8pub struct Cli {}
9
10impl Cli {
11    pub fn exec(self) -> Result<()> {
12        app::set_repo_dir()?;
13
14        #[allow(clippy::case_sensitive_file_extension_comparisons)]
15        app::exec(
16            "shellcheck",
17            ["--external-sources", "--shell", "bash"].into_iter().chain(
18                git::list_files()?
19                    .iter()
20                    .filter_map(|name| name.ends_with(".sh").then_some(name.as_str())),
21            ),
22            true,
23        )
24    }
25}