diff --git a/docs/adr/0031-markdown-for-terminal-output.md b/docs/adr/0031-markdown-for-terminal-output.md new file mode 100644 index 00000000..b331fac7 --- /dev/null +++ b/docs/adr/0031-markdown-for-terminal-output.md @@ -0,0 +1,19 @@ +# 31. markdown for terminal output + +Date: 2021-03-17 + +## Status + +2021-03-17 proposed + +## Context + +Context here... + +## Decision + +Decision here... + +## Consequences + +Consequences here... diff --git a/docs/adr/README.md b/docs/adr/README.md index 45fbecbc..e8742dc7 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -30,3 +30,4 @@ * [28. kubernetes-analysis](0028-kubernetes-analysis.md) * [29. integration-openapi-source-code](0029-integration-openapi-source-code.md) * [30. extract-infrastructure-mod](0030-extract-infrastructure-mod.md) +* [31. markdown-for-terminal-output](0031-markdown-for-terminal-output.md) diff --git a/src/app/analysis/git_analysis/commit_analysis.rs b/src/app/analysis/git_analysis/commit_analysis.rs index 94ede295..62cde18b 100644 --- a/src/app/analysis/git_analysis/commit_analysis.rs +++ b/src/app/analysis/git_analysis/commit_analysis.rs @@ -1,6 +1,7 @@ use crate::domain::git::CocoCommit; use crate::infrastructure::git::cmd_git::commit_message; use crate::infrastructure::git::git_log_parser::GitMessageParser; +use core_model::coco_config::CocoCommitConfig; use core_model::url_format; use serde::{Deserialize, Serialize}; @@ -37,7 +38,7 @@ impl ShortCommit { } } -pub fn analysis(url: &str) -> Vec { +pub fn analysis(url: &str, commit_config: Option>) -> Vec { let local_path = url_format::uri_to_path(url); let messages = commit_message(Some(format!("{}", local_path.display()))); diff --git a/src/app/analysis/mod.rs b/src/app/analysis/mod.rs index 203c8589..6f02fdbc 100644 --- a/src/app/analysis/mod.rs +++ b/src/app/analysis/mod.rs @@ -10,17 +10,20 @@ use core_model::Settings; use core_model::{CocoConfig, RepoConfig}; use crate::domain::CocoOpt; +use core_model::coco_config::CocoCommitConfig; use rayon::prelude::*; use std::time::Instant; pub struct Analyst { repos: Vec, + commit_config: Option>, } impl From<&CocoConfig> for Analyst { fn from(config: &CocoConfig) -> Self { Self { repos: config.repos.clone(), + commit_config: config.commit_config.clone(), } } } @@ -35,7 +38,7 @@ impl Analyst { analysis_branches(url_str); } if cli_option.commits { - analysis_commits(url_str); + analysis_commits(url_str, self.commit_config.clone()); } if cli_option.tags { analysis_tags(url_str); @@ -93,8 +96,8 @@ fn analysis_file_history(url_str: &str, git_years: f64) { fs::write(output_file, result).expect("cannot write file"); } -fn analysis_commits(url_str: &str) { - let branches = commit_analysis::analysis(url_str); +fn analysis_commits(url_str: &str, commit_config: Option>) { + let branches = commit_analysis::analysis(url_str, commit_config); let file_name = url_format::json_filename_suffix(url_str, Some("-commits")); let result = serde_json::to_string_pretty(&branches).unwrap();