diff --git a/src/info.rs b/src/info.rs index 0320aef07..b4b420c80 100644 --- a/src/info.rs +++ b/src/info.rs @@ -293,6 +293,7 @@ impl Info { image_backend: Option>, no_merges: bool, color_blocks_flag: bool, + author_nb: usize, ) -> Result { let repo = Repository::discover(&dir).map_err(|_| Error::NotGitRepo)?; let workdir = repo.workdir().ok_or(Error::BareGitRepo)?; @@ -300,7 +301,7 @@ impl Info { let config = Info::get_configuration(&repo)?; let current_commit_info = Info::get_current_commit_info(&repo)?; - let authors = Info::get_authors(workdir_str, no_merges, 3); + let authors = Info::get_authors(workdir_str, no_merges, author_nb); let (git_v, git_user) = Info::get_git_info(workdir_str); let version = Info::get_version(workdir_str)?; let commits = Info::get_commits(workdir_str, no_merges)?; diff --git a/src/main.rs b/src/main.rs index a8803dc3c..7796c5df7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,6 +219,13 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]", .long("no-color-blocks") .help("Hide the color blocks"), ) + .arg( + Arg::with_name("authors-number") + .short("A") + .long("authors-number") + .takes_value(true) + .help("Defines the number of authors to be shown"), + ) .get_matches(); if matches.is_present("languages") { @@ -231,6 +238,7 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]", } let dir = String::from(matches.value_of("directory").unwrap()); + let custom_logo: Language = if let Some(ascii_language) = matches.value_of("ascii-language") { Language::from_str(&ascii_language.to_lowercase()).unwrap() } else { @@ -301,6 +309,12 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]", let color_blocks_flag = matches.is_present("no-color-blocks"); + let author_number: usize = if let Some(value) = matches.value_of("authors-number") { + usize::from_str(value).unwrap() + } else { + 3 + }; + let info = Info::new( &dir, custom_logo, @@ -311,6 +325,7 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]", image_backend, no_merges, color_blocks_flag, + author_number, )?; print!("{}", info);