From 577464ea225a2e6d32343c0f016ac84f5d1fd801 Mon Sep 17 00:00:00 2001 From: Xudong Zheng <7pkvm5aw@slicealias.com> Date: Fri, 2 Sep 2016 10:41:54 -0400 Subject: [PATCH 1/3] Add author and license information --- readme.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/readme.md b/readme.md index 93d2a48..429e648 100644 --- a/readme.md +++ b/readme.md @@ -43,4 +43,34 @@ a list of repository every time. ![](https://i.imgur.com/FW0cp6M.png) +## Author + +[Xudong Zheng](https://www.xudongz.com/) + +## License + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From d9525a3ebd2b98ce2aa9de246628c04d055f6461 Mon Sep 17 00:00:00 2001 From: Philipp Klose Date: Fri, 2 Sep 2016 17:20:56 +0200 Subject: [PATCH 2/3] accept multiple authors separated by commas --- main.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f27e86a..1d8109a 100644 --- a/main.go +++ b/main.go @@ -51,6 +51,14 @@ func handlePath(path string) error { // Initialize buffered reader for stdout. buf := bufio.NewReader(stdout) + var authors []string + if *author != "" { + authors = strings.Split(*author, ",") + for i, a := range authors { + authors[i] = strings.Trim(a, " ") + } + } + // Read commit timestamps line by line. Parse in ISO8601 format, which is // virtually identical to RFC3339. for { @@ -62,8 +70,17 @@ func handlePath(path string) error { } line = strings.TrimSuffix(line, "\n") pieces := strings.SplitN(line, " ", 2) - if *author != "" && pieces[1] != *author { - continue + if *author != "" { + found := false + for _, a := range authors { + if pieces[1] == a { + found = true + continue + } + } + if !found { + continue + } } parse, err := time.Parse(timeFormat, pieces[0][:10]) if err != nil { From 9623fe2a293ee70e4601b1a3f0936eeafca2c43e Mon Sep 17 00:00:00 2001 From: Philipp Klose Date: Fri, 2 Sep 2016 17:23:44 +0200 Subject: [PATCH 3/3] added note in readme about multiple authors --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 429e648..705c88f 100644 --- a/readme.md +++ b/readme.md @@ -17,6 +17,10 @@ You can limit it to a specific user by specifying their email address. `gitstreak -author user@example.org path/to/repo` +You can name multiple email addresses by separating them by a comma. + +`gitstreak -author user@example.org,another@example.org path/to/repo` + If you have a single directory with all your repositories, you can easily include each repository.