-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add releases command to list project versions
- Loading branch information
Showing
11 changed files
with
429 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package jiracmd | ||
|
||
import ( | ||
"github.com/coryb/figtree" | ||
"github.com/coryb/oreo" | ||
"github.com/go-jira/jira" | ||
"github.com/go-jira/jira/jiracli" | ||
kingpin "gopkg.in/alecthomas/kingpin.v2" | ||
) | ||
|
||
type ReleasesOptions struct { | ||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` | ||
Project string `yaml:"project,omitempty" json:"project,omitempty"` | ||
Status []string | ||
Query string | ||
OrderBy string | ||
} | ||
|
||
func CmdReleasesRegistry() *jiracli.CommandRegistryEntry { | ||
opts := ReleasesOptions{ | ||
CommonOptions: jiracli.CommonOptions{ | ||
Template: figtree.NewStringOption("releases"), | ||
}, | ||
} | ||
|
||
return &jiracli.CommandRegistryEntry{ | ||
Help: "List project releases", | ||
UsageFunc: func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error { | ||
jiracli.LoadConfigs(cmd, fig, &opts) | ||
return CmdReleasesUsage(cmd, &opts) | ||
}, | ||
ExecuteFunc: func(o *oreo.Client, globals *jiracli.GlobalOptions) error { | ||
return CmdReleases(o, globals, &opts) | ||
}, | ||
} | ||
} | ||
|
||
func CmdReleasesUsage(cmd *kingpin.CmdClause, opts *ReleasesOptions) error { | ||
jiracli.TemplateUsage(cmd, &opts.CommonOptions) | ||
jiracli.GJsonQueryUsage(cmd, &opts.CommonOptions) | ||
cmd.Flag("query", "filter the results using a literal string").Short('q').StringVar(&opts.Query) | ||
cmd.Flag("status", "list of status values used to filter the results by version status").Short('s').StringsVar(&opts.Status) | ||
cmd.Flag("order", "order the results by a field: description, name, releaseDate, sequence, startDate").StringVar(&opts.OrderBy) | ||
cmd.Arg("PROJECT", "project id or key").Required().StringVar(&opts.Project) | ||
return nil | ||
} | ||
|
||
func CmdReleases(o *oreo.Client, globals *jiracli.GlobalOptions, opts *ReleasesOptions) error { | ||
data, err := jira.GetProjectVersionsPaginated(o, globals.Endpoint.Value, opts.Project, opts.Status, opts.Query, opts.OrderBy) | ||
if err != nil { | ||
return err | ||
} | ||
if err := opts.PrintTemplate(data); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
package jiradata | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
// This Code is Generated by SlipScheme Project: | ||
// https://github.com/coryb/slipscheme | ||
// | ||
// Generated with command: | ||
// slipscheme -dir jiradata -pkg jiradata -overwrite schemas/PageofVersion.json | ||
///////////////////////////////////////////////////////////////////////// | ||
// DO NOT EDIT // | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
// PageOfVersion defined from schema: | ||
// { | ||
// "title": "Page of Version", | ||
// "id": "https://docs.atlassian.com/jira/REST/schema/page-of-version#", | ||
// "type": "object", | ||
// "properties": { | ||
// "isLast": { | ||
// "title": "isLast", | ||
// "type": "boolean" | ||
// }, | ||
// "maxResults": { | ||
// "title": "maxResults", | ||
// "type": "integer" | ||
// }, | ||
// "nextPage": { | ||
// "title": "nextPage", | ||
// "type": "string" | ||
// }, | ||
// "self": { | ||
// "title": "self", | ||
// "type": "string" | ||
// }, | ||
// "startAt": { | ||
// "title": "startAt", | ||
// "type": "integer" | ||
// }, | ||
// "total": { | ||
// "title": "total", | ||
// "type": "integer" | ||
// }, | ||
// "values": { | ||
// "title": "values", | ||
// "type": "array", | ||
// "items": { | ||
// "title": "Version", | ||
// "type": "object", | ||
// "properties": { | ||
// "archived": { | ||
// "title": "archived", | ||
// "type": "boolean" | ||
// }, | ||
// "description": { | ||
// "title": "description", | ||
// "type": "string" | ||
// }, | ||
// "expand": { | ||
// "title": "expand", | ||
// "type": "string" | ||
// }, | ||
// "id": { | ||
// "title": "id", | ||
// "type": "string" | ||
// }, | ||
// "moveUnfixedIssuesTo": { | ||
// "title": "moveUnfixedIssuesTo", | ||
// "type": "string" | ||
// }, | ||
// "name": { | ||
// "title": "name", | ||
// "type": "string" | ||
// }, | ||
// "operations": { | ||
// "title": "operations", | ||
// "type": "array", | ||
// "items": { | ||
// "title": "Simple Link", | ||
// "type": "object", | ||
// "properties": { | ||
// "href": { | ||
// "title": "href", | ||
// "type": "string" | ||
// }, | ||
// "iconClass": { | ||
// "title": "iconClass", | ||
// "type": "string" | ||
// }, | ||
// "id": { | ||
// "title": "id", | ||
// "type": "string" | ||
// }, | ||
// "label": { | ||
// "title": "label", | ||
// "type": "string" | ||
// }, | ||
// "styleClass": { | ||
// "title": "styleClass", | ||
// "type": "string" | ||
// }, | ||
// "title": { | ||
// "title": "title", | ||
// "type": "string" | ||
// }, | ||
// "weight": { | ||
// "title": "weight", | ||
// "type": "integer" | ||
// } | ||
// } | ||
// } | ||
// }, | ||
// "overdue": { | ||
// "title": "overdue", | ||
// "type": "boolean" | ||
// }, | ||
// "project": { | ||
// "title": "project", | ||
// "type": "string" | ||
// }, | ||
// "projectId": { | ||
// "title": "projectId", | ||
// "type": "integer" | ||
// }, | ||
// "released": { | ||
// "title": "released", | ||
// "type": "boolean" | ||
// }, | ||
// "remotelinks": { | ||
// "title": "remotelinks", | ||
// "type": "array", | ||
// "items": { | ||
// "title": "Remote Entity Link", | ||
// "type": "object", | ||
// "properties": { | ||
// "link": { | ||
// "title": "link" | ||
// }, | ||
// "name": { | ||
// "title": "name", | ||
// "type": "string" | ||
// }, | ||
// "self": { | ||
// "title": "self", | ||
// "type": "string" | ||
// } | ||
// } | ||
// } | ||
// }, | ||
// "self": { | ||
// "title": "self", | ||
// "type": "string" | ||
// }, | ||
// "userReleaseDate": { | ||
// "title": "userReleaseDate", | ||
// "type": "string" | ||
// }, | ||
// "userStartDate": { | ||
// "title": "userStartDate", | ||
// "type": "string" | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
type PageOfVersion struct { | ||
IsLast bool `json:"isLast,omitempty" yaml:"isLast,omitempty"` | ||
MaxResults int `json:"maxResults,omitempty" yaml:"maxResults,omitempty"` | ||
NextPage string `json:"nextPage,omitempty" yaml:"nextPage,omitempty"` | ||
Self string `json:"self,omitempty" yaml:"self,omitempty"` | ||
StartAt int `json:"startAt,omitempty" yaml:"startAt,omitempty"` | ||
Total int `json:"total,omitempty" yaml:"total,omitempty"` | ||
Values Values `json:"values,omitempty" yaml:"values,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.