diff --git a/Commands.md b/Commands.md index 07c9b98..9f58bc5 100644 --- a/Commands.md +++ b/Commands.md @@ -726,7 +726,6 @@ Updating AUTHORS file: $ git authors && cat AUTHORS TJ Holowaychuk -Tj Holowaychuk hemanth.hm Jonhnny Weslley nickl- @@ -739,13 +738,24 @@ Listing authors: $ git authors --list TJ Holowaychuk -Tj Holowaychuk hemanth.hm Jonhnny Weslley nickl- Leila Muhtasib ``` +Listing authors without email: + +```bash +$ git authors --list --no-email + +TJ Holowaychuk +hemanth.hm +Jonhnny Weslley +nickl- +Leila Muhtasib +``` + ## git back Removes the latest commits, and add their changes to your staging area. diff --git a/bin/git-authors b/bin/git-authors index 2e51aff..8ededdb 100755 --- a/bin/git-authors +++ b/bin/git-authors @@ -1,15 +1,29 @@ #!/usr/bin/env bash LIST=false +NO_EMAIL=false FILE="" EDITOR=$(git var GIT_EDITOR) -if test "$1" = "-l" || test "$1" = "--list"; then - LIST=true -else +while [[ $# -gt 0 ]]; do + case $1 in + -l|--list ) + LIST=true + shift + ;; + --no-email ) + NO_EMAIL=true + shift + ;; + * ) + break + esac +done + +if ! $LIST; then FILE=$1 if test "$FILE" = ""; then - FILE=`ls | egrep 'authors|contributors' -i|head -n1` + FILE=$(ls | egrep 'authors|contributors' -i|head -n1) if test "$FILE" = ""; then FILE='AUTHORS' fi @@ -21,7 +35,13 @@ fi # authors() { - git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' + if $NO_EMAIL; then + # eamil will be used to uniq authors. + git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' \ + | awk -F'<' '{print $1}' + else + git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' + fi } # @@ -29,7 +49,7 @@ authors() { # if $LIST; then - echo "$(authors)" + authors else authors >> $FILE test -n "$EDITOR" && $EDITOR $FILE diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 9478e26..ce404ca 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -29,7 +29,7 @@ _git_chore(){ } _git_authors(){ - __gitcomp "-l --list" + __gitcomp "-l --list --no-email" } _git_contrib(){ diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index daaabf5..9465cab 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -109,6 +109,7 @@ __gitex_author_names() { _git-authors() { _arguments -C \ '(--list -l)'{--list,-l}'[show authors]' \ + '--no-email[without email]' \ } _git-bug() { diff --git a/man/git-authors.1 b/man/git-authors.1 index 391b772..f0a0477 100644 --- a/man/git-authors.1 +++ b/man/git-authors.1 @@ -1,13 +1,13 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-AUTHORS" "1" "December 2015" "" "" +.TH "GIT\-AUTHORS" "1" "October 2016" "" "" . .SH "NAME" \fBgit\-authors\fR \- Generate authors report . .SH "SYNOPSIS" -\fBgit\-authors\fR [\-l, \-\-list] +\fBgit\-authors\fR [\-l, \-\-list] [\-\-no\-email] . .SH "DESCRIPTION" Populates the file matching \fIauthors|contributors \-i\fR with the authors of commits, according to the number of commits per author\. Opens the file in \fB$EDITOR\fR when set\. @@ -21,6 +21,12 @@ See the "MAPPING AUTHORS" section of \fBgit\-shortlog\fR(1) to coalesce together .P Show authors\. . +.P +\-\-no\-email +. +.P +Don\'t show authors\' email\. +. .SH "EXAMPLES" . .TP @@ -40,7 +46,6 @@ $ git authors \-\-list .nf TJ Holowaychuk -Tj Holowaychuk hemanth\.hm Jonhnny Weslley nickl\- @@ -50,6 +55,27 @@ Leila Muhtasib . .IP "" 0 +. +.TP +Listing authors without email: +. +.IP +$ git authors \-\-list \-\-no\-email +. +.IP "" 4 +. +.nf + +TJ Holowaychuk +hemanth\.hm +Jonhnny Weslley +nickl\- +Leila Muhtasib +. +.fi +. +.IP "" 0 + . .SH "AUTHOR" Written by Titus Wormer <\fItituswormer@gmail\.com\fR> diff --git a/man/git-authors.html b/man/git-authors.html index d67bf7f..e15abc2 100644 --- a/man/git-authors.html +++ b/man/git-authors.html @@ -76,7 +76,7 @@

SYNOPSIS

-

git-authors [-l, --list]

+

git-authors [-l, --list] [--no-email]

DESCRIPTION

@@ -91,6 +91,10 @@

Show authors.

+

--no-email

+ +

Don't show authors' email.

+

EXAMPLES

@@ -102,18 +106,27 @@

$ git authors --list

TJ Holowaychuk <tj@vision-media.ca>
-Tj Holowaychuk <tj@vision-media.ca>
 hemanth.hm <hemanth.hm@gmail.com>
 Jonhnny Weslley <jw@jonhnnyweslley.net>
 nickl- <github@jigsoft.co.za>
 Leila Muhtasib <muhtasib@gmail.com>
 
+
Listing authors without email:

+ +

$ git authors --list --no-email

+ +
TJ Holowaychuk
+hemanth.hm
+Jonhnny Weslley
+nickl-
+Leila Muhtasib
+

AUTHOR

-

Written by Titus Wormer <tituswormer@gmail.com>

+

Written by Titus Wormer <tituswormer@gmail.com>

REPORTING BUGS

@@ -126,7 +139,7 @@ Leila Muhtasib <muhtasib@gmail.com>
  1. -
  2. December 2015
  3. +
  4. October 2016
  5. git-authors(1)
diff --git a/man/git-authors.md b/man/git-authors.md index 8ff4943..ed3fee0 100644 --- a/man/git-authors.md +++ b/man/git-authors.md @@ -3,7 +3,7 @@ git-authors(1) -- Generate authors report ## SYNOPSIS -`git-authors` [-l, --list] +`git-authors` [-l, --list] [--no-email] ## DESCRIPTION @@ -18,6 +18,10 @@ git-authors(1) -- Generate authors report Show authors. + --no-email + + Don't show authors' email. + ## EXAMPLES * Updating AUTHORS file: @@ -30,13 +34,24 @@ git-authors(1) -- Generate authors report ``` TJ Holowaychuk - Tj Holowaychuk hemanth.hm Jonhnny Weslley nickl- Leila Muhtasib ``` + * Listing authors without email: + + $ git authors --list --no-email + + ``` + TJ Holowaychuk + hemanth.hm + Jonhnny Weslley + nickl- + Leila Muhtasib + ``` + ## AUTHOR Written by Titus Wormer <>