mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-22 18:06:11 +00:00
feat: add --sort [TYPE] flag (#78)
* feat(chglog): add --sort flag * chore(sort): update README with --sort usage
This commit is contained in:
parent
34b9d5c997
commit
e523fd471a
4 changed files with 11 additions and 1 deletions
|
|
@ -198,6 +198,7 @@ OPTIONS:
|
|||
--jira-url value Jira URL [$JIRA_URL]
|
||||
--jira-username value Jira username [$JIRA_USERNAME]
|
||||
--jira-token value Jira token [$JIRA_TOKEN]
|
||||
--sort value Specify how to sort tags; currently supports "date" or by "semver" (default: date)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
NoCaseSensitive: ctx.NoCaseSensitive,
|
||||
Paths: ctx.Paths,
|
||||
CommitFilters: opts.Commits.Filters,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ type CLIContext struct {
|
|||
JiraToken string
|
||||
JiraURL string
|
||||
Paths []string
|
||||
Sort string
|
||||
}
|
||||
|
||||
// InitContext ...
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue