samber / git-contrib-graph

📊 Displays a github-like contribution graph, of every contributors of a repository
10 stars 11 forks source link

Add --json argument for json output #10

Closed edenriquez closed 5 years ago

edenriquez commented 5 years ago

This PR Fixes https://github.com/samber/git-contrib-graph/issues/2

samber commented 5 years ago

Can you rebase on master ?

We added unit tests. Can you check if returned json is parsed correctly by jq plz ?

edenriquez commented 5 years ago

@samber sure i will rebase this night :) and see testing coverage

samber commented 5 years ago

To date, there is no unit test: only a CI with classic checks for go ;)

You're right, we should add some basic tests !

I will create a new issue.

edenriquez commented 5 years ago

@samber about first comment

Could you only display json in output, for that case plz ?

you mean for each case display only json like

################################################################################
################################################################################

{"author": "foobar@example.com"} ...

and when there is no --json flag

################################################################################
################################################################################

Author: foobar@example.com ...

is it right ?

samber commented 5 years ago

@eduenriquez Please display only JSON: without separator or anything else.

You should be able to parse it with jq ;)

edenriquez commented 5 years ago

done @samber see README of json flag output, then i cannot figure out how to run jq for my output do you have an example ? what i do is

./gitlog-jq.sh output.json

but this happends

./gitlog-jq.sh: line 4: jq: command not found
./gitlog-jq.sh: line 4: jq: command not found
./gitlog-jq.sh: line 4: jq: command not found
./gitlog-jq.sh: line 4: jq: command not found

so how i can install jq, is a golang dependency or bin script ?

samber commented 5 years ago

To install jq => https://stedolan.github.io/jq/download/

Example:

echo '{"toto": 42}' | jq .