flags

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllDefaultFlags = append([]cli.Flag{
	&RepoFlag,
	&RemoteFlag,
}, LoginOutputFlags...)

AllDefaultFlags defines flags that should be available for all subcommands working with dedicated repositories to work around issue and provide --login, --repo and --output: https://github.com/urfave/cli/issues/585

View Source
var IssueListingFlags = append([]cli.Flag{
	&StateFlag,
	&cli.StringFlag{
		Name:        "kind",
		Aliases:     []string{"K"},
		Usage:       "Whether to return `issues`, `pulls`, or `all` (you can use this to apply advanced search filters to PRs)",
		DefaultText: "issues",
	},
	&cli.StringFlag{
		Name:    "keyword",
		Aliases: []string{"k"},
		Usage:   "Filter by search string",
	},
	LabelFilterFlag,
	MilestoneFilterFlag,
	&cli.StringFlag{
		Name:    "author",
		Aliases: []string{"A"},
	},
	&cli.StringFlag{
		Name:    "assignee",
		Aliases: []string{"a"},
	},
	&cli.StringFlag{
		Name:    "mentions",
		Aliases: []string{"M"},
	},
	&cli.StringFlag{
		Name:    "from",
		Aliases: []string{"F"},
		Usage:   "Filter by activity after this date",
	},
	&cli.StringFlag{
		Name:    "until",
		Aliases: []string{"u"},
		Usage:   "Filter by activity before this date",
	},
	&PaginationPageFlag,
	&PaginationLimitFlag,
}, AllDefaultFlags...)

IssueListingFlags defines flags that should be available on issue listing flags.

View Source
var IssuePREditFlags = append([]cli.Flag{
	&cli.StringFlag{
		Name:    "title",
		Aliases: []string{"t"},
	},
	&cli.StringFlag{
		Name:    "description",
		Aliases: []string{"d"},
	},
	&cli.StringFlag{
		Name:    "assignees",
		Aliases: []string{"a"},
		Usage:   "Comma-separated list of usernames to assign",
	},
	&cli.StringFlag{
		Name:    "labels",
		Aliases: []string{"L"},
		Usage:   "Comma-separated list of labels to assign",
	},
	&cli.StringFlag{
		Name:    "deadline",
		Aliases: []string{"D"},
		Usage:   "Deadline timestamp to assign",
	},
	&cli.StringFlag{
		Name:    "milestone",
		Aliases: []string{"m"},
		Usage:   "Milestone to assign",
	},
}, LoginRepoFlags...)

IssuePREditFlags defines flags for properties of issues and PRs

View Source
var LabelFilterFlag = NewCsvFlag(
	"labels",
	"labels to match issues against",
	[]string{"L"}, nil, nil)

LabelFilterFlag is a CSV flag used to filter issues by labels

View Source
var LoginFlag = cli.StringFlag{
	Name:    "login",
	Aliases: []string{"l"},
	Usage:   "Use a different Gitea Login. Optional",
}

LoginFlag provides flag to specify tea login profile

View Source
var LoginOutputFlags = []cli.Flag{
	&LoginFlag,
	&OutputFlag,
}

LoginOutputFlags defines login and output flags that should added to all subcommands and appended to the flags of the subcommand to work around issue and provide --login and --output: https://github.com/urfave/cli/issues/585

View Source
var LoginRepoFlags = []cli.Flag{
	&LoginFlag,
	&RepoFlag,
	&RemoteFlag,
}

LoginRepoFlags defines login and repo flags that should be used for all subcommands and appended to the flags of the subcommand to work around issue and provide --login and --repo: https://github.com/urfave/cli/issues/585

View Source
var MilestoneFilterFlag = NewCsvFlag(
	"milestones",
	"milestones to match issues against",
	[]string{"m"}, nil, nil)

MilestoneFilterFlag is a CSV flag used to filter issues by milestones

View Source
var NotificationFlags = append([]cli.Flag{
	NotificationStateFlag,
	&cli.BoolFlag{
		Name:    "mine",
		Aliases: []string{"m"},
		Usage:   "Show notifications across all your repositories instead of the current repository only",
	},
	&PaginationPageFlag,
	&PaginationLimitFlag,
}, AllDefaultFlags...)

NotificationFlags defines flags that should be available on notifications.

View Source
var NotificationStateFlag = NewCsvFlag(
	"states",
	"notification states to filter by",
	[]string{"s"},
	[]string{"pinned", "unread", "read"},
	[]string{"unread", "pinned"},
)

NotificationStateFlag is a csv flag applied to all notification subcommands as filter

View Source
var OutputFlag = cli.StringFlag{
	Name:    "output",
	Aliases: []string{"o"},
	Usage:   "Output format. (csv, simple, table, tsv, yaml)",
}

OutputFlag provides flag to specify output type

View Source
var PRListingFlags = append([]cli.Flag{
	&StateFlag,
	&PaginationPageFlag,
	&PaginationLimitFlag,
}, AllDefaultFlags...)

PRListingFlags defines flags that should be available on pr listing flags.

View Source
var PaginationLimitFlag = cli.StringFlag{
	Name:    "limit",
	Aliases: []string{"lm"},
	Usage:   "specify limit of items per page",
}

PaginationLimitFlag provides flag for pagination options

View Source
var PaginationPageFlag = cli.StringFlag{
	Name:    "page",
	Aliases: []string{"p"},
	Usage:   "specify page, default is 1",
}

PaginationPageFlag provides flag for pagination options

View Source
var RemoteFlag = cli.StringFlag{
	Name:    "remote",
	Aliases: []string{"R"},
	Usage:   "Discover Gitea login from remote. Optional",
}

RemoteFlag provides flag to specify remote repository

View Source
var RepoFlag = cli.StringFlag{
	Name:    "repo",
	Aliases: []string{"r"},
	Usage:   "Override local repository path or gitea repository slug to interact with. Optional",
}

RepoFlag provides flag to specify repository

View Source
var StateFlag = cli.StringFlag{
	Name:        "state",
	Usage:       "Filter by state (all|open|closed)",
	DefaultText: "open",
}

StateFlag provides flag to specify issue/pr state, defaulting to "open"

Functions

func GetIssuePREditFlags added in v0.7.0

func GetIssuePREditFlags(ctx *context.TeaContext) (*gitea.CreateIssueOption, error)

GetIssuePREditFlags parses all IssuePREditFlags

Types

type CsvFlag added in v0.8.0

type CsvFlag struct {
	cli.StringFlag
	AvailableFields []string
}

CsvFlag is a wrapper around cli.StringFlag, with an added GetValues() method to retrieve comma separated string values as a slice.

func FieldsFlag added in v0.7.0

func FieldsFlag(availableFields, defaultFields []string) *CsvFlag

FieldsFlag generates a flag selecting printable fields. To retrieve the value, use f.GetValues()

func NewCsvFlag added in v0.8.0

func NewCsvFlag(name, usage string, aliases, availableValues, defaults []string) *CsvFlag

NewCsvFlag creates a CsvFlag, while setting its usage string and default values

func (CsvFlag) GetValues added in v0.8.0

func (f CsvFlag) GetValues(ctx *cli.Context) ([]string, error)

GetValues returns the value of the flag, parsed as a commaseparated list

Jump to

Keyboard shortcuts

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