From 510514b64e642d34d05ba721dd190104238b57ab Mon Sep 17 00:00:00 2001 From: Kamil Samigullin Date: Sun, 18 Apr 2021 23:18:03 +0300 Subject: [PATCH] issue #30: extend changelog by contribution diff command --- docs/changelog.md | 17 ++++++++++++++++- docs/readme.md | 19 +++++++++++++++++-- internal/command/github/view/diff.go | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 8b48ed6..8a7b762 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -58,7 +58,7 @@ $ maintainer github contribution lookup /3 # -> now()/3 == now()/-1 ``` - * Makes a snapshot of contributions for a specified year + * Makes a snapshot of contributions for a specified year or shows changes ```bash $ maintainer github contribution snapshot 2013 | tee /tmp/snap.01.2013.json | jq @@ -67,6 +67,21 @@ ... "2013-12-27T00:00:00Z": 2 } + + $ maintainer github contribution diff --base=/tmp/snap.01.2013.json 2013 + Day / Week #46 #48 #49 #50 + ---------------------- --------------- --------------- --------------- ----------- + Sunday - - - - + Monday - - - - + Tuesday - - - - + Wednesday +4 - +1 - + Thursday - - - +1 + Friday - +2 - - + Saturday - - - - + ---------------------- --------------- --------------- --------------- ----------- + The diff between head{"/tmp/snap.02.2013.json"} → base{"/tmp/snap.01.2013.json"} + + $ maintainer github contribution diff --base=/tmp/snap.01.2013.json --head=/tmp/snap.02.2013.json ``` * Suggests a reasonable date to contribute diff --git a/docs/readme.md b/docs/readme.md index bab2d35..038dbb6 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -58,15 +58,30 @@ $ maintainer github contribution lookup /3 # -> now()/3 == now()/-1 ``` - * Makes a snapshot of contributions for a specified year + * Makes a snapshot of contributions for a specified year or shows changes ```bash - $ maintainer github contribution snapshot 2013 | tee snap.2013.json | jq + $ maintainer github contribution snapshot 2013 | tee /tmp/snap.01.2013.json | jq { "2013-11-13T00:00:00Z": 1, ... "2013-12-27T00:00:00Z": 2 } + + $ maintainer github contribution diff --base=/tmp/snap.01.2013.json 2013 + Day / Week #46 #48 #49 #50 + ---------------------- --------------- --------------- --------------- ----------- + Sunday - - - - + Monday - - - - + Tuesday - - - - + Wednesday +4 - +1 - + Thursday - - - +1 + Friday - +2 - - + Saturday - - - - + ---------------------- --------------- --------------- --------------- ----------- + The diff between head{"/tmp/snap.02.2013.json"} → base{"/tmp/snap.01.2013.json"} + + $ maintainer github contribution diff --base=/tmp/snap.01.2013.json --head=/tmp/snap.02.2013.json ``` * Suggests a reasonable date to contribute diff --git a/internal/command/github/view/diff.go b/internal/command/github/view/diff.go index 8c19d61..b584cae 100644 --- a/internal/command/github/view/diff.go +++ b/internal/command/github/view/diff.go @@ -2,6 +2,7 @@ package view import ( "fmt" + "github.com/alexeyco/simpletable" "go.octolab.org/toolset/maintainer/internal/model/github/contribution"