jiracli

package
v1.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerDeploymentType = "server"
	CloudDeploymentType  = "cloud"
)

Variables

View Source
var AllTemplates = map[string]string{
	"attach-list":    defaultAttachListTemplate,
	"comment":        defaultCommentTemplate,
	"component-add":  defaultComponentAddTemplate,
	"components":     defaultComponentsTemplate,
	"create":         defaultCreateTemplate,
	"createmeta":     defaultDebugTemplate,
	"debug":          defaultDebugTemplate,
	"edit":           defaultEditTemplate,
	"editmeta":       defaultDebugTemplate,
	"epic-create":    defaultEpicCreateTemplate,
	"epic-list":      defaultTableTemplate,
	"fields":         defaultDebugTemplate,
	"issuelinktypes": defaultDebugTemplate,
	"issuetypes":     defaultIssuetypesTemplate,
	"json":           defaultDebugTemplate,
	"list":           defaultListTemplate,
	"request":        defaultDebugTemplate,
	"subtask":        defaultSubtaskTemplate,
	"table":          defaultTableTemplate,
	"transition":     defaultTransitionTemplate,
	"transitions":    defaultTransitionsTemplate,
	"transmeta":      defaultDebugTemplate,
	"view":           defaultViewTemplate,
	"worklog":        defaultWorklogTemplate,
	"worklogs":       defaultWorklogsTemplate,
}
View Source
var EditLoopAbort = fmt.Errorf("edit Loop aborted by request")
View Source
var FileAbort = fmt.Errorf("file processing aborted")

Functions

func BrowseUsage

func BrowseUsage(cmd *kingpin.CmdClause, opts *CommonOptions)

func CliError

func CliError(cause error) error

func CommandLine added in v1.0.21

func CommandLine(fig *figtree.FigTree, o *oreo.Client) *kingpin.Application

func ConfigTemplate added in v1.0.6

func ConfigTemplate(fig *figtree.FigTree, template, command string, opts interface{}) (string, error)

func ConvertType added in v1.0.8

func ConvertType(input interface{}, output interface{}) error

func EditLoop

func EditLoop(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error

func EditorUsage

func EditorUsage(cmd *kingpin.CmdClause, opts *CommonOptions)

func FileUsage added in v1.0.28

func FileUsage(cmd *kingpin.CmdClause, opts *CommonOptions)

func FlagValue

func FlagValue(ctx *kingpin.ParseContext, name string) string

func FormatIssue added in v1.0.23

func FormatIssue(issueKey string, project string) string

func GJsonQueryUsage added in v1.0.5

func GJsonQueryUsage(cmd *kingpin.CmdClause, opts *CommonOptions)

func HandleExit added in v1.0.21

func HandleExit()

HandleExit will unwind any panics and check to see if they are jiracli.Exit and exit accordingly.

Example:

func main() {
    defer jiracli.HandleExit()
    ...
}

func Homedir

func Homedir() string

func IncreaseLogLevel added in v1.0.21

func IncreaseLogLevel(verbosity int)

func InitLogging added in v1.0.21

func InitLogging()

func LoadConfigs

func LoadConfigs(cmd *kingpin.CmdClause, fig *figtree.FigTree, opts interface{})

func ParseCommandLine added in v1.0.21

func ParseCommandLine(app *kingpin.Application, args []string)

func ReadYmlInputFile added in v1.0.28

func ReadYmlInputFile(opts *CommonOptions, input interface{}, output interface{}, submit func() error) error

func RegisterCommand added in v1.0.21

func RegisterCommand(regEntry CommandRegistry)

func RunTemplate

func RunTemplate(templateName string, data interface{}, out io.Writer) error

func TemplateProcessor

func TemplateProcessor() *template.Template

func TemplateUsage

func TemplateUsage(cmd *kingpin.CmdClause, opts *CommonOptions)

Types

type CommandRegistry

type CommandRegistry struct {
	Command string
	Aliases []string
	Entry   *CommandRegistryEntry
	Default bool
}

type CommandRegistryEntry

type CommandRegistryEntry struct {
	Help        string
	UsageFunc   func(*figtree.FigTree, *kingpin.CmdClause) error
	ExecuteFunc func(*oreo.Client, *GlobalOptions) error
}

type CommonOptions

type CommonOptions struct {
	Browse      figtree.BoolOption   `yaml:"browse,omitempty" json:"browse,omitempty"`
	Editor      figtree.StringOption `yaml:"editor,omitempty" json:"editor,omitempty"`
	File        figtree.StringOption `yaml:"file,omitempty" json:"file,omitempty"`
	GJsonQuery  figtree.StringOption `yaml:"gjq,omitempty" json:"gjq,omitempty"`
	SkipEditing figtree.BoolOption   `yaml:"noedit,omitempty" json:"noedit,omitempty"`
	Template    figtree.StringOption `yaml:"template,omitempty" json:"template,omitempty"`
}

func (*CommonOptions) PrintTemplate added in v1.0.5

func (o *CommonOptions) PrintTemplate(data interface{}) error

type Error

type Error struct {
	// contains filtered or unexported fields
}

type Exit

type Exit struct {
	Code int
}

type GlobalOptions

type GlobalOptions struct {
	// AuthenticationMethod is the method we use to authenticate with the jira serivce. Possible values are "api-token" or "session".
	// The default is "api-token" when the service endpoint ends with "atlassian.net", otherwise it "session".  Session authentication
	// will promt for user password and use the /auth/1/session-login endpoint.
	AuthenticationMethod figtree.StringOption `yaml:"authentication-method,omitempty" json:"authentication-method,omitempty"`

	// Endpoint is the URL for the Jira service.  Something like: https://go-jira.atlassian.net
	Endpoint figtree.StringOption `yaml:"endpoint,omitempty" json:"endpoint,omitempty"`

	// Insecure will allow you to connect to an https endpoint with a self-signed SSL certificate
	Insecure figtree.BoolOption `yaml:"insecure,omitempty" json:"insecure,omitempty"`

	// Login is the id used for authenticating with the Jira service.  For "api-token" AuthenticationMethod this is usually a
	// full email address, something like "user@example.com".  For "session" AuthenticationMethod this will be something
	// like "user", which by default will use the same value in the `User` field.
	Login figtree.StringOption `yaml:"login,omitempty" json:"login,omitempty"`

	// PasswordSource specificies the method that we fetch the password.  Possible values are "keyring" or "pass".
	// If this is unset we will just prompt the user.  For "keyring" this will look in the OS keychain, if missing
	// then prompt the user and store the password in the OS keychain.  For "pass" this will look in the PasswordDirectory
	// location using the `pass` tool, if missing prompt the user and store in the PasswordDirectory
	PasswordSource figtree.StringOption `yaml:"password-source,omitempty" json:"password-source,omitempty"`

	// PasswordSourcePath can be used to specify the path to the PasswordSource binary to use.
	PasswordSourcePath figtree.StringOption `yaml:"password-source-path,omitempty" json:"password-source-path,omitempty"`

	// PasswordDirectory is only used for the "pass" PasswordSource.  It is the location for the encrypted password
	// files used by `pass`.  Effectively this overrides the "PASSWORD_STORE_DIR" environment variable
	PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"`

	// PasswordName is the the name of the password key entry stored used with PasswordSource `pass`.
	PasswordName figtree.StringOption `yaml:"password-name,omitempty" json:"password-name,omitempty"`

	// Quiet will lower the defalt log level to suppress the standard output for commands
	Quiet figtree.BoolOption `yaml:"quiet,omitempty" json:"quiet,omitempty"`

	// SocksProxy is used to configure the http client to access the Endpoint via a socks proxy.  The value
	// should be a ip address and port string, something like "127.0.0.1:1080"
	SocksProxy figtree.StringOption `yaml:"socksproxy,omitempty" json:"socksproxy,omitempty"`

	// UnixProxy is use to configure the http client to access the Endpoint via a local unix domain socket used
	// to proxy requests
	UnixProxy figtree.StringOption `yaml:"unixproxy,omitempty" json:"unixproxy,omitempty"`

	// User is use to represent the user on the Jira service.  This can be different from the username used to
	// authenticate with the service.  For example when using AuthenticationMethod `api-token` the Login is
	// typically an email address like `username@example.com` and the User property would be someting like
	// `username`  The User property is used on Jira service API calls that require a user to associate with
	// an Issue (like assigning a Issue to yourself)
	User figtree.StringOption `yaml:"user,omitempty" json:"user,omitempty"`

	// JiraDeploymentType can be `cloud` or `server`, if not set it will be inferred from
	// the /rest/api/2/serverInfo REST API.
	JiraDeploymentType figtree.StringOption `yaml:"jira-deployment-type,omitempty" json:"jira-deployment-type,omitempty"`
	// contains filtered or unexported fields
}

func (*GlobalOptions) AuthMethod added in v1.0.21

func (o *GlobalOptions) AuthMethod() string

func (*GlobalOptions) GetPass

func (o *GlobalOptions) GetPass() string

func (*GlobalOptions) GetPasswordPath added in v1.0.23

func (o *GlobalOptions) GetPasswordPath() string

func (*GlobalOptions) ProvideAuthParams

func (o *GlobalOptions) ProvideAuthParams() *jiradata.AuthParams

func (*GlobalOptions) SetPass

func (o *GlobalOptions) SetPass(passwd string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL