Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
56 changes: 32 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
module github.com/go-jira/jira

go 1.12
go 1.24

require (
github.com/Masterminds/sprig v2.21.0+incompatible
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1
github.com/google/go-cmp v0.6.0
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
github.com/mitchellh/go-wordwrap v1.0.1
github.com/olekukonko/tablewriter v0.0.3
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15
github.com/pkg/errors v0.8.0
github.com/samber/lo v1.51.0
github.com/stretchr/testify v1.2.2
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1
golang.org/x/crypto v0.23.0
golang.org/x/net v0.25.0
gopkg.in/AlecAivazis/survey.v1 v1.6.1
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
)

require (
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.21.0+incompatible
github.com/Netflix/go-expect v0.0.0-20180928190340-9d1f4485533b // indirect
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e
github.com/coryb/oreo v0.0.0-20180804211640-3e1b88fc08f1
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/google/go-cmp v0.5.2
github.com/google/uuid v1.1.1 // indirect
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 // indirect
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c // indirect
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kr/pretty v0.1.0
github.com/kr/pretty v0.1.0 // indirect
github.com/kr/pty v1.1.4 // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
github.com/mitchellh/go-wordwrap v1.0.1
github.com/olekukonko/tablewriter v0.0.3
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15
github.com/pkg/errors v0.8.0
github.com/mattn/go-runewidth v0.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
github.com/theckman/go-flock v0.4.0 // indirect
github.com/tidwall/gjson v0.0.0-20180711011033-ba784d767ac7
github.com/tidwall/match v1.0.0 // indirect
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb
golang.org/x/net v0.0.0-20171102191033-01c190206fbd
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e // indirect
gopkg.in/AlecAivazis/survey.v1 v1.6.1
gopkg.in/alecthomas/kingpin.v2 v2.2.6
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.22.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/coryb/yaml.v2 v2.0.0-20180616071044-0e40e46f7153
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
gopkg.in/yaml.v2 v2.2.2 // indirect
)
27 changes: 16 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZq
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
github.com/coryb/figtree v0.0.0-20180728224503-071d1ef303df h1:cS4Z9Nlv8J4UqFbLp9ltZypgenm2p3Jeg0yqLfpH2pc=
github.com/coryb/figtree v0.0.0-20180728224503-071d1ef303df/go.mod h1:uAkZUEGm6dROpxfy+8vXLs7JrLCI4O+gQyKAuISxI/g=
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d h1:99xxg8FYj+5TYg88DxA4xL8ODuI6OvuSu35WQOVPDPg=
github.com/coryb/figtree v1.0.1-0.20190907170512-58176d03ef0d/go.mod h1:uAkZUEGm6dROpxfy+8vXLs7JrLCI4O+gQyKAuISxI/g=
github.com/coryb/kingpeon v0.0.0-20180107011214-9a669f143f2e h1:tGmk9Tuyz7fKuBq/d3nFJvVWRvc48MEBKQC4uYV3wb0=
Expand All @@ -24,8 +22,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/guelfey/go.dbus v0.0.0-20131113121618-f6a3a2366cc3 h1:fngCxKbvZdctIsWj2hYijhAt4iK0JXSSA78B36xP0yI=
Expand Down Expand Up @@ -59,12 +57,16 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/olekukonko/tablewriter v0.0.3 h1:i0LBnzgiChAWHJYTQAZJDOgf8MNxAVYZJ2m63SIDimI=
github.com/olekukonko/tablewriter v0.0.3/go.mod h1:YZeBtGzYYEsCHp2LST/u/0NDwGkRoBtmn1cIWCJiS6M=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15 h1:mrI+6Ae64Wjt+uahGe5we/sPS1sXjvfT3YjtawAVgps=
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
Expand All @@ -75,13 +77,16 @@ github.com/tidwall/match v1.0.0 h1:Ym1EcFkp+UQ4ptxfWlW+iMdq5cPH5nEuGzdf/Pb7VmI=
github.com/tidwall/match v1.0.0/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1 h1:+gXfyhy0t28Guz+vFztBg45yIquB2bNtiFvbItzJtUc=
github.com/tmc/keyring v0.0.0-20171121202319-839169085ae1/go.mod h1:gsa3jftQ3xia55nzIN4lXLYzDcWdxjojdKoz+N0St2Y=
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb h1:Ah9YqXLj6fEgeKqcmBuLCbAsrF3ScD7dJ/bYM0C6tXI=
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20171102191033-01c190206fbd h1:CLQSRrSDQMOMkogMxky7XOkERftMegAnxjT2re4E66M=
golang.org/x/net v0.0.0-20171102191033-01c190206fbd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e h1:3dQ4fR8k5KugjVKO0oqSd1odxuk2yaE2CIfxWP2WarQ=
golang.org/x/sys v0.0.0-20180727230415-bd9dbc187b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
gopkg.in/AlecAivazis/survey.v1 v1.6.1 h1:HyWkjKGBpzhNxrpaKRLDqoa4L1f4cMVBNU4bnVmU8Mw=
gopkg.in/AlecAivazis/survey.v1 v1.6.1/go.mod h1:2Ehl7OqkBl3Xb8VmC4oFW2bItAhnUfzIjrOzwRxCrOU=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
Expand Down
95 changes: 81 additions & 14 deletions jiracli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"text/template"
"net/url"

yaml "gopkg.in/coryb/yaml.v2"

Expand All @@ -23,7 +24,12 @@ import (
wordwrap "github.com/mitchellh/go-wordwrap"
"github.com/olekukonko/tablewriter"
"golang.org/x/crypto/ssh/terminal"
"github.com/samber/lo"
)
type GSub struct {
re *regexp.Regexp
sub string
}

func findTemplate(name string) ([]byte, error) {
if file, err := findClosestParentPath(filepath.Join(".jira.d", "templates", name)); err == nil {
Expand Down Expand Up @@ -67,6 +73,31 @@ func tmpTemplate(templateName string, data interface{}) (string, error) {
}

func TemplateProcessor() *template.Template {
var userMap map[string]string
dir, err := os.UserHomeDir()
if err != nil { panic(err) }

doc, err := ioutil.ReadFile(dir + "/work/jirausersmap.json")
if err != nil {
panic(err)
}

err = json.Unmarshal([]byte(doc), &userMap)
if err != nil {
panic(err)
}

var regexps = []GSub {
GSub{ regexp.MustCompile(`\[(.*?)\|(.*?)\|.*?\]`), `[$1]($2)` },
GSub{ regexp.MustCompile(`{{(.*?)}}`), "`$1`" },
GSub{ regexp.MustCompile(`-(.*)-`), "~$1~" },
GSub{ regexp.MustCompile(`{color:#......}(.*?){color}`), "**$1**" },
}

for accountid, displayName := range userMap {
regexps = append(regexps, GSub{ regexp.MustCompile(fmt.Sprintf("\\[~accountid:%v\\]", accountid)), fmt.Sprintf("@%v",displayName) } )
}

funcs := map[string]interface{}{
"jira": func() string {
return os.Args[0]
Expand Down Expand Up @@ -99,6 +130,16 @@ func TemplateProcessor() *template.Template {
}
return string(bytes), nil
},
"pathEscape": func(str string) string {
return url.PathEscape(str)
},
"toMd": func(str string) string {

foo := func(agg string, gsub GSub, i int)(string) {
return gsub.re.ReplaceAllString(agg, gsub.sub)
}
return lo.Reduce(regexps, foo, str)
},
"termWidth": func() int {
w, _, err := terminal.GetSize(int(os.Stdout.Fd()))
if err == nil {
Expand Down Expand Up @@ -258,28 +299,52 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error {
return err
}

table := tablewriter.NewWriter(out)
table.SetAutoFormatHeaders(false)
headers := []string{}
cells := [][]string{}
footerTable := tablewriter.NewWriter(out)
footerTable.SetAutoFormatHeaders(false)
footerHeaders := []string{}
footerCells := [][]string{}

var table *tablewriter.Table
var table_str *strings.Builder
tmpl, err := TemplateProcessor().Funcs(map[string]interface{}{
"newTable": func(mw int) string {
table_str = new(strings.Builder)
table = tablewriter.NewWriter(table_str)
table.SetAutoFormatHeaders(false)
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.SetColWidth(mw)
return ""
},
"tableHeaders": func(args ...string) string {
table.SetHeader(args)
return ""
},
"tableRow": func(args ...string) string {
table.Append(args)
return ""
},
"tableRender": func() string {
table.Render()
return table_str.String()
},
"defaultColWidth": func(cw int) string {
table.SetColWidth(cw)
footerTable.SetColWidth(cw)
return ""
},
"headers": func(titles ...string) string {
headers = append(headers, titles...)
footerHeaders = append(footerHeaders, titles...)
return ""
},
"row": func() string {
cells = append(cells, []string{})
footerCells = append(footerCells, []string{})
return ""
},
"cell": func(value interface{}) (string, error) {
if len(cells) == 0 {
if len(footerCells) == 0 {
return "", fmt.Errorf(`"cell" template function called before "row" template function`)
}
cells[len(cells)-1] = append(cells[len(cells)-1], fmt.Sprintf("%v", value))
footerCells[len(footerCells)-1] = append(footerCells[len(footerCells)-1], fmt.Sprintf("%v", value))
return "", nil
},
}).Parse(templateContent)
Expand All @@ -290,10 +355,12 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error {
if err := tmpl.Execute(out, rawData); err != nil {
return err
}
if len(headers) > 0 || len(cells) > 0 {
table.SetHeader(headers)
table.AppendBulk(cells)
table.Render()
if len(footerHeaders) > 0 || len(footerCells) > 0 {
footerTable.SetHeader(footerHeaders)
footerTable.AppendBulk(footerCells)
footerTable.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
footerTable.SetCenterSeparator("|")
footerTable.Render()
}

return nil
Expand Down Expand Up @@ -333,7 +400,7 @@ const defaultListTemplate = "{{ range .issues }}{{ .key | append \":\" | printf

const defaultTableTemplate = `{{/* table template */ -}}
{{- headers "Issue" "Summary" "Type" "Priority" "Status" "Age" "Reporter" "Assignee" -}}
{{- range .issues -}}
{{- range .issues -}}
{{- row -}}
{{- cell .key -}}
{{- cell .fields.summary -}}
Expand Down
1 change: 1 addition & 0 deletions jiracmd/attachGet.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func CmdAttachGetUsage(cmd *kingpin.CmdClause, opts *AttachGetOptions) error {
}

func CmdAttachGet(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachGetOptions) error {
fmt.Println(opts)
attachment, err := jira.GetAttachment(o, globals.Endpoint.Value, opts.AttachmentID)
if err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions jiracmd/attachList.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ func CmdAttachList(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AttachL
}
sort.Sort(&attachments)

for _, attachment := range attachments {
attachment.Local = "/tmp/attachment_" + attachment.Filename
getOpts := AttachGetOptions {
OutputFile: attachment.Local,
AttachmentID: string(attachment.ID),
}
err := CmdAttachGet(o, globals, &getOpts)
if err != nil {
return err
}
}

if err := opts.PrintTemplate(attachments); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions jiracmd/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "github.com/go-jira/jira/jiracli"

func RegisterAllCommands() {
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "acknowledge", Entry: CmdTransitionRegistry("acknowledge"), Aliases: []string{"ack"}})
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "users", Entry: CmdUsersRegistry()})
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "assign", Entry: CmdAssignRegistry(), Aliases: []string{"give"}})
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "attach create", Entry: CmdAttachCreateRegistry()})
jiracli.RegisterCommand(jiracli.CommandRegistry{Command: "attach get", Entry: CmdAttachGetRegistry()})
Expand Down
52 changes: 52 additions & 0 deletions jiracmd/users.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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 UsersOptions struct {
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"`
}

func CmdUsersRegistry() *jiracli.CommandRegistryEntry {
opts := UsersOptions{
CommonOptions: jiracli.CommonOptions{
Template: figtree.NewStringOption("json"),
},
}

return &jiracli.CommandRegistryEntry{
"list org users",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
return CmdUsersUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
return CmdUsers(o, globals, &opts)
},
}
}

func CmdUsersUsage(cmd *kingpin.CmdClause, opts *UsersOptions) error {
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
return nil
}

func CmdUsers(o *oreo.Client, globals *jiracli.GlobalOptions, opts *UsersOptions) error {
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
Query: "*",
MaxResults: 1000,
})
if err != nil {
return err
}

if err := opts.PrintTemplate(users); err != nil {
return err
}
return nil
}
Loading