git-mit-config 6.0.11

A command for enabling and disabling git lints
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::env::current_dir;

use miette::{IntoDiagnostic, Result};
use mit_commit_message_lints::{external, lints::read_from_toml_or_else_vcs, scope::Scope};
use mit_lint::Lints;

use crate::get_vcs;

pub fn run(scope: Scope) -> Result<()> {
    let current_dir = current_dir().into_diagnostic()?;
    let vcs = get_vcs(scope == Scope::Local, &current_dir)?;
    let toml = external::read_toml(current_dir)?;

    let lints = read_from_toml_or_else_vcs(&toml, &vcs)?;
    mit_commit_message_lints::console::style::lint_table(Lints::available(), &lints);

    Ok(())
}