diff --git a/src/template_quickjs.rs b/src/chk_quickjs.rs similarity index 98% rename from src/template_quickjs.rs rename to src/chk_quickjs.rs index c7986e7..3ec1425 100644 --- a/src/template_quickjs.rs +++ b/src/chk_quickjs.rs @@ -1,7 +1,7 @@ use quick_js::{Context, JsValue}; use quick_js::console::{Level, ConsoleBackend}; use rust_util::XResult; -use crate::template::CommitMsgCheck; +use crate::chk::CommitMsgCheck; pub struct CommitMsgCheckQuickJs { context: Context, diff --git a/src/template_regex.rs b/src/chk_regex.rs similarity index 97% rename from src/template_regex.rs rename to src/chk_regex.rs index b1bc3b0..ebed284 100644 --- a/src/template_regex.rs +++ b/src/chk_regex.rs @@ -1,6 +1,6 @@ use regex::Regex; 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*.*"; diff --git a/src/cmd_default.rs b/src/cmd_default.rs index e29a3ea..ecbdf2f 100644 --- a/src/cmd_default.rs +++ b/src/cmd_default.rs @@ -1,8 +1,8 @@ use clap::{App, Arg, ArgMatches}; use crate::cmd::CommandError; -use crate::template::CommitMsgCheck; -use crate::template_regex::CommitMsgCheckRegex; -use crate::template_quickjs::CommitMsgCheckQuickJs; +use crate::chk::CommitMsgCheck; +use crate::chk_regex::CommitMsgCheckRegex; +use crate::chk_quickjs::CommitMsgCheckQuickJs; pub struct CommandImpl; @@ -35,6 +35,8 @@ commit-msg usage"#); b.print_hint(); } + println!("{:#?}", rust_util::util_git::git_status_change(None)); + Ok(()) } } \ No newline at end of file diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..73f02cd --- /dev/null +++ b/src/config.rs @@ -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, +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ac8f442..a52c7bf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,14 @@ #[macro_use] extern crate rust_util; +mod config; mod util; mod cmd; mod cmd_default; mod cmd_usage; mod cmd_install; -mod template; -mod template_regex; -mod template_quickjs; +mod chk; +mod chk_regex; +mod chk_quickjs; use clap::App; use cmd::{Command, CommandError}; diff --git a/src/template.rs b/src/template.rs deleted file mode 100644 index 0c320bc..0000000 --- a/src/template.rs +++ /dev/null @@ -1,6 +0,0 @@ - -pub trait CommitMsgCheck { - fn check(&self, msg: &str) -> bool; - - fn print_hint(&self); -}