8000 feat: add `--sort [TYPE]` flag by sanderblue · Pull Request #78 · git-chglog/git-chglog · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --sort [TYPE] flag #78

Merged
merged 2 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/git-chglog/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (config *Config) Convert(ctx *CLIContext) *chglog.Config {
Options: &chglog.Options{
NextTag: ctx.NextTag,
TagFilterPattern: ctx.TagFilterPattern,
Sort: opts.Sort,
Sort: orValue(ctx.Sort, opts.Sort),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This was what I was looking for. 😀

NoCaseSensitive: ctx.NoCaseSensitive,
Paths: ctx.Paths,
CommitFilters: opts.Commits.Filters,
Expand Down
1 change: 1 addition & 0 deletions cmd/git-chglog/context.go
8000
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type CLIContext struct {
JiraToken string
JiraURL string
Paths []string
Sort string
}

// InitContext ...
Expand Down
8 changes: 8 additions & 0 deletions cmd/git-chglog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ func CreateApp(actionFunc cli.ActionFunc) *cli.App {
EnvVars: []string{"JIRA_TOKEN"},
},

// sort
&cli.StringFlag{
Name: "sort",
Usage: "Specify how to sort tags; currently supports \"date\" or by \"semver\"",
DefaultText: "date",
},

// help & version
cli.HelpFlag,
cli.VersionFlag,
Expand Down Expand Up @@ -240,6 +247,7 @@ func AppAction(c *cli.Context) error {
JiraToken: c.String("jira-token"),
JiraURL: c.String("jira-url"),
Paths: c.StringSlice("path"),
Sort: c.String("sort"),
},
fs,
NewConfigLoader(),
Expand Down
0