feat: rename, add git status change
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use quick_js::{Context, JsValue};
|
use quick_js::{Context, JsValue};
|
||||||
use quick_js::console::{Level, ConsoleBackend};
|
use quick_js::console::{Level, ConsoleBackend};
|
||||||
use rust_util::XResult;
|
use rust_util::XResult;
|
||||||
use crate::template::CommitMsgCheck;
|
use crate::chk::CommitMsgCheck;
|
||||||
|
|
||||||
pub struct CommitMsgCheckQuickJs {
|
pub struct CommitMsgCheckQuickJs {
|
||||||
context: Context,
|
context: Context,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use rust_util::util_term::{BOLD, UNDER, END};
|
use rust_util::util_term::{BOLD, UNDER, END};
|
||||||
use crate::template::CommitMsgCheck;
|
use crate::chk::CommitMsgCheck;
|
||||||
|
|
||||||
const DEFAULT_COMMIT_MSG_REGEXP: &str = "^(feat|fix|docs|style|refactor|test|chore)(\\([\\w\\-_.]+\\))?:\\s*.*";
|
const DEFAULT_COMMIT_MSG_REGEXP: &str = "^(feat|fix|docs|style|refactor|test|chore)(\\([\\w\\-_.]+\\))?:\\s*.*";
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
use clap::{App, Arg, ArgMatches};
|
use clap::{App, Arg, ArgMatches};
|
||||||
use crate::cmd::CommandError;
|
use crate::cmd::CommandError;
|
||||||
use crate::template::CommitMsgCheck;
|
use crate::chk::CommitMsgCheck;
|
||||||
use crate::template_regex::CommitMsgCheckRegex;
|
use crate::chk_regex::CommitMsgCheckRegex;
|
||||||
use crate::template_quickjs::CommitMsgCheckQuickJs;
|
use crate::chk_quickjs::CommitMsgCheckQuickJs;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
|
|
||||||
@@ -35,6 +35,8 @@ commit-msg usage"#);
|
|||||||
b.print_hint();
|
b.print_hint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("{:#?}", rust_util::util_git::git_status_change(None));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
src/config.rs
Normal file
15
src/config.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
/// Commit message config
|
||||||
|
/// ./commit_msg.json
|
||||||
|
/// ~/.commit_msg.json
|
||||||
|
/// ty can be:
|
||||||
|
/// - template
|
||||||
|
/// - script
|
||||||
|
/// name:
|
||||||
|
/// if ty == template; template name
|
||||||
|
/// if ty == script; script name, script can be abstract or home relate for config dir
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct CommitMsgConfig {
|
||||||
|
ty: String,
|
||||||
|
name: String,
|
||||||
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
#[macro_use] extern crate rust_util;
|
#[macro_use] extern crate rust_util;
|
||||||
|
|
||||||
|
mod config;
|
||||||
mod util;
|
mod util;
|
||||||
mod cmd;
|
mod cmd;
|
||||||
mod cmd_default;
|
mod cmd_default;
|
||||||
mod cmd_usage;
|
mod cmd_usage;
|
||||||
mod cmd_install;
|
mod cmd_install;
|
||||||
mod template;
|
mod chk;
|
||||||
mod template_regex;
|
mod chk_regex;
|
||||||
mod template_quickjs;
|
mod chk_quickjs;
|
||||||
|
|
||||||
use clap::App;
|
use clap::App;
|
||||||
use cmd::{Command, CommandError};
|
use cmd::{Command, CommandError};
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
pub trait CommitMsgCheck {
|
|
||||||
fn check(&self, msg: &str) -> bool;
|
|
||||||
|
|
||||||
fn print_hint(&self);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user