vdev 0.3.1

CLI utilities for Vector (vector.dev) development and CI workflows
use anyhow::Result;

use crate::{app, utils::git};

/// Check that shell scripts do not have common mistakes
#[derive(clap::Args, Debug)]
#[command()]
pub struct Cli {}

impl Cli {
    pub fn exec(self) -> Result<()> {
        app::set_repo_dir()?;

        #[allow(clippy::case_sensitive_file_extension_comparisons)]
        app::exec(
            "shellcheck",
            ["--external-sources", "--shell", "bash"].into_iter().chain(
                git::list_files()?
                    .iter()
                    .filter_map(|name| name.ends_with(".sh").then_some(name.as_str())),
            ),
            true,
        )
    }
}