deltam / changelog2json

Convert changelog memo to JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

changelog2json

Convert changelog memo to JSON.

Suggest to use with jq.

Install

$ go get -u github.com/deltam/changelog2json

Usage

sample changelog

$ cat changelog.txt
2018-06-29  Nanashi Gombeh  <deltam@gmail.com>

        * life: shopping list
        - milk
        - eggs

        * todo: dev
        - write test code
        - refactoring

2018-06-28  Nanashi Gombeh  <deltam@gmail.com>

        * lunch: Ramen Shop Hogehoge
        Very good!

convert to json(and pipe jq).

$ changelog2json changelog.txt | jq
[
	{
		"date": "2018-06-29",
		"name": "Nanashi Gombeh",
		"mail": "deltam@gmail.com",
		"tags": "life",
		"title": "shopping list",
		"body": "        - milk\n        - eggs\n\n",
		"line": 3
	},
	{
		"date": "2018-06-29",
		"name": "Nanashi Gombeh",
		"mail": "deltam@gmail.com",
		"tags": "todo",
		"title": "dev",
		"body": "        - write test code\n        - refactoring\n\n",
		"line": 7
	},
	{
		"date": "2018-06-28",
		"name": "Nanashi Gombeh",
		"mail": "deltam@gmail.com",
		"tags": "jj",
		"title": "Ramen Shop Hogehoge",
		"body": "        Very good!\n",
		"line": 13
	}
]

Filtering by tag

$ changelog2json changelog.txt | jq '.[] | select(.tags == "todo")'
[
	{
		"date": "2018-06-29",
		"name": "Nanashi Gombeh",
		"mail": "deltam@gmail.com",
		"tags": "todo",
		"title": "dev",
		"body": "        - write test code\n        - refactoring\n\n",
		"line": 7
	}
]

more filtering tips, to see jq manual.

License

MIT

About

Convert changelog memo to JSON.

License:MIT License


Languages

Language:Go 100.0%