WLLL2ADLZCFVCKAFSF3HWIICTDPAK3NTEYK3ZAGSP5YEPSKNU4KQC
HXCFU6ZFK2G33HC3VX2PAQTL3UJK4BG472O4G6T5YF3ZOQKIE4HQC
2TXT5LGDNIJNMM4EORWKP35BGREM3RPDQ7IUEXZFKQ4N6LGNPLWQC
J7BHVCMJUCMXWHHXQLJQXPMM22VJTYFQGXIGRHUOFBAUS65WA6DQC
4FCEKFETVRRY5ZNAO44GFUCEIXYCM3J2MRTUQ7CUYZ2ZHANWI2MAC
27L7IZBULKDP76DFPUBKKJHLP7XIXN3KFKSMYS35TU6Y574LUUYQC
- [ ] better error handling
use crate::{cli::CommitCommand, conventional::Config, Command, Error};
use crate::{ cli::CommitCommand, conventional::{CommitParser, Config}, Command, Error,};
use crate::{
cli::CommitCommand,
conventional::{CommitParser, Config},
Command, Error,
};
parser: CommitParser,
let mut first_line = self.type_as_string().to_owned();
let mut msg = self.type_as_string().to_owned();
first_line.push('('); first_line.push_str(scope.as_str()); first_line.push(')');
first_line.push('(');
first_line.push_str(scope.as_str());
first_line.push(')');
msg.push('('); msg.push_str(scope.as_str()); msg.push(')');
msg.push('(');
msg.push_str(scope.as_str());
msg.push(')');
first_line.push('!');
msg.push('!');
first_line.push_str(": "); first_line.push_str(description.as_str()); // build the command let mut cmd = std::process::Command::new("git"); cmd.args(&["commit", "-m", first_line.as_str()]);
first_line.push_str(": ");
first_line.push_str(description.as_str());
// build the command
let mut cmd = std::process::Command::new("git");
cmd.args(&["commit", "-m", first_line.as_str()]);
msg.push_str(": "); msg.push_str(description.as_str());
msg.push_str(": ");
msg.push_str(description.as_str());
cmd.args(&["-m", body.as_str()]);
msg.push_str("\n\n"); msg.push_str(body.as_str())
msg.push_str("\n\n");
msg.push_str(body.as_str())
cmd.args(&[ "-m", format!("BREAKING CHANGE: {}", breaking_change).as_str(), ]);
cmd.args(&[
"-m",
format!("BREAKING CHANGE: {}", breaking_change).as_str(),
]);
msg.push_str("\n\n"); msg.push_str(format!("BREAKING CHANGE: {}", breaking_change).as_str());
msg.push_str(format!("BREAKING CHANGE: {}", breaking_change).as_str());
cmd.args(&["-m", format!("Refs: {}", issues).as_str()]);
msg.push_str("\n\n"); msg.push_str(format!("Refs: {}", issues).as_str());
msg.push_str(format!("Refs: {}", issues).as_str());
// validate by parsing parser .parse(msg.as_str()) .expect("Matches conventional commit"); // build the command let mut cmd = std::process::Command::new("git"); cmd.args(&["commit", "-m", msg.as_str()]);
// validate by parsing
parser
.parse(msg.as_str())
.expect("Matches conventional commit");
cmd.args(&["commit", "-m", msg.as_str()]);
fn exec(&self, _: Config) -> Result<(), Error> {
fn exec(&self, config: Config) -> Result<(), Error> {
self.commit(scope, description, body, breaking_change, issues)?;
let parser = CommitParser::builder() .scope_regex(config.scope_regex) .build(); self.commit(scope, description, body, breaking_change, issues, parser)?;
let parser = CommitParser::builder()
.scope_regex(config.scope_regex)
.build();
self.commit(scope, description, body, breaking_change, issues, parser)?;