diff --git a/.gitgo/chglog/CHANGELOG.tpl.md b/.gitgo/chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..791f3c5 --- /dev/null +++ b/.gitgo/chglog/CHANGELOG.tpl.md @@ -0,0 +1,49 @@ +{{ if .Versions -}} + +## [Unreleased] + +{{ if .Unreleased.CommitGroups -}} +{{ range .Unreleased.CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{ range .Versions }} + +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} +{{ range .CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} + +{{- if .MergeCommits -}} +### Pull Requests +{{ range .MergeCommits -}} +- {{ .Header }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{- if .Versions }} +[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD +{{ range .Versions -}} +{{ if .Tag.Previous -}} +[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} +{{ end -}} +{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/.gitgo/chglog/config.yml b/.gitgo/chglog/config.yml new file mode 100755 index 0000000..ef2872a --- /dev/null +++ b/.gitgo/chglog/config.yml @@ -0,0 +1,35 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/kamontat/gitgo +options: + commits: + filters: + Type: + - feat + - improve + - perf + - fix + - doc + - test + commit_groups: + title_maps: + feat: Feature + improve: Improving application + perf: Improving performance + fix: Fixes Bug + doc: Documentation + test: Testing + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + issues: + prefix: + - "#" + notes: + keywords: + - BREAKING CHANGE \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d8079b0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,144 @@ + + +## [Unreleased] + +### Feature + +- **changelog:** add --tag to custom tag name + + + +## [v3.0.1] - 2019-02-06 + +### Improving application + +- **local:** add readme file in local configuration + +### Testing + +- **config:** refactor test due to model changes + + + +## [v3.0.0] - 2019-02-05 + +### Feature + +- **ui-prompt:** add scope to commit message + +### Improving performance + +- **config:** start implement new format of commit message BREAKING CHANGE: change format of config file which no able to use with the old version + + + +## [v2.4.0] - 2018-11-06 + + + +## [v2.3.2] - 2018-09-28 + + + +## [v2.3.1] - 2018-09-13 + + + +## [v2.3.0] - 2018-09-12 + + + +## [v2.2.1] - 2018-09-12 + + + +## [v2.2.0] - 2018-09-12 + + + +## [v2.1.0] - 2018-09-12 + + + +## [3.0.0] - 2018-08-23 + + + +## [v2.0.2] - 2018-08-21 + + + +## [v2.0.1] - 2018-08-16 + + + +## [v2.0.0] - 2018-08-16 + + + +## [v1.4.1] - 2018-06-25 + + + +## [1.4.0-alpha.1] - 2018-05-05 + + + +## [1.3.0-beta.1] - 2018-04-11 + + + +## [1.3.0-alpha.1] - 2018-04-11 + + + +## [1.1.6] - 2018-04-10 + + + +## [1.1.4] - 2018-04-10 + + + +## [1.1.3] - 2018-04-07 + + + +## [1.0.0-beta.2] - 2018-04-04 + + + +## [0.0.1-alpha.6] - 2018-04-03 + + + +## [0.0.1-alpha.5] - 2018-04-03 + + + +## 0.0.1-alpha.3 - 2018-04-02 + +[unreleased]: https://github.com/kamontat/gitgo/compare/v3.0.1...HEAD +[v3.0.1]: https://github.com/kamontat/gitgo/compare/v3.0.0...v3.0.1 +[v3.0.0]: https://github.com/kamontat/gitgo/compare/v2.4.0...v3.0.0 +[v2.4.0]: https://github.com/kamontat/gitgo/compare/v2.3.2...v2.4.0 +[v2.3.2]: https://github.com/kamontat/gitgo/compare/v2.3.1...v2.3.2 +[v2.3.1]: https://github.com/kamontat/gitgo/compare/v2.3.0...v2.3.1 +[v2.3.0]: https://github.com/kamontat/gitgo/compare/v2.2.1...v2.3.0 +[v2.2.1]: https://github.com/kamontat/gitgo/compare/v2.2.0...v2.2.1 +[v2.2.0]: https://github.com/kamontat/gitgo/compare/v2.1.0...v2.2.0 +[v2.1.0]: https://github.com/kamontat/gitgo/compare/3.0.0...v2.1.0 +[3.0.0]: https://github.com/kamontat/gitgo/compare/v2.0.2...3.0.0 +[v2.0.2]: https://github.com/kamontat/gitgo/compare/v2.0.1...v2.0.2 +[v2.0.1]: https://github.com/kamontat/gitgo/compare/v2.0.0...v2.0.1 +[v2.0.0]: https://github.com/kamontat/gitgo/compare/v1.4.1...v2.0.0 +[v1.4.1]: https://github.com/kamontat/gitgo/compare/1.4.0-alpha.1...v1.4.1 +[1.4.0-alpha.1]: https://github.com/kamontat/gitgo/compare/1.3.0-beta.1...1.4.0-alpha.1 +[1.3.0-beta.1]: https://github.com/kamontat/gitgo/compare/1.3.0-alpha.1...1.3.0-beta.1 +[1.3.0-alpha.1]: https://github.com/kamontat/gitgo/compare/1.1.6...1.3.0-alpha.1 +[1.1.6]: https://github.com/kamontat/gitgo/compare/1.1.4...1.1.6 +[1.1.4]: https://github.com/kamontat/gitgo/compare/1.1.3...1.1.4 +[1.1.3]: https://github.com/kamontat/gitgo/compare/1.0.0-beta.2...1.1.3 +[1.0.0-beta.2]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.6...1.0.0-beta.2 +[0.0.1-alpha.6]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.5...0.0.1-alpha.6 +[0.0.1-alpha.5]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.3...0.0.1-alpha.5 diff --git a/cmd/changelog.go b/cmd/changelog.go index 038e870..f3c25b4 100644 --- a/cmd/changelog.go +++ b/cmd/changelog.go @@ -50,14 +50,14 @@ var changelogCmd = &cobra.Command{ if err != nil { e.ShowAndExit(e.ErrorMessage(e.IsChangelog, "Config file not exist in .gitgo folder")) } - - args := []string{"--config", config, "--output", changelogName} + + chgArgs := []string{"--config", config, "--output", changelogName} if nextTag != "" { - args = append(args, "--next-tag") - args = append(args, nextTag) + chgArgs = append(chgArgs, "--next-tag") + chgArgs = append(chgArgs, nextTag) } - c = exec.Command("git-chglog", args...) + c = exec.Command("git-chglog", chgArgs...) c.Stdout = os.Stdout c.Stderr = os.Stderr @@ -81,6 +81,6 @@ func init() { // Cobra supports local flags which will only run when this command // is called directly, e.g.: changelogCmd.Flags().StringVarP(&changelogName, "location", "l", "./CHANGELOG.md", "Output file location") - + changelogCmd.Flags().StringVarP(&nextTag, "tag", "t", "", "custom tag instead of git-tag") } diff --git a/cmd/root.go b/cmd/root.go index 0454256..6b43839 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -43,7 +43,7 @@ var repo *model.Repo var debug bool var verbose bool -var version = "3.0.1" +var version = "3.1.0" // rootCmd represents the base command when called without any subcommands. var rootCmd = &cobra.Command{ @@ -59,6 +59,7 @@ And the problem I got is I forget which emoji is represent what. And hard to generate changelog file. So I think 'short key text' is the solution of situation. +3.1.0 -> Add --tag to changelog generator 3.0.1 -> Add README file to local config 3.0.0 -> Change commit format and refactor code 2.4.0 -> Add --empty to allow empty changes to commit code diff --git a/model/commit.go b/model/commit.go index a9a4f83..5703ae8 100644 --- a/model/commit.go +++ b/model/commit.go @@ -47,7 +47,7 @@ func (c *Commit) getQuestion() []*survey.Question { Message: "Enter commit type scope", Help: "Scope should represent the scope of commit type", }, - Validate: survey.MaxLength(8), + Validate: survey.MaxLength(12), }, { Name: "title", Prompt: &survey.Input{