flags

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RepoFlag stores the value of --repo flag
	RepoFlag string
	// LoginFlag stores the value of --login flag
	LoginFlag string
	// RemoteFlag stores the value of --remote flag
	RemoteFlag string
	// OutputFlag stores the value of --output flag
	OutputFlag string
)

Common flag variables (exported for external access)

View Source
var Mime bool
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

Functions

func BindCommonFlags

func BindCommonFlags(cmd *cobra.Command, withOutput bool)

BindCommonFlags binds all common flags to the given command cmd: Command instance to bind flags withOutput: Whether to enable --output flag (some commands may not need it)

func BindDefaultFlags

func BindDefaultFlags(cmd *cobra.Command)

func BindLoginOutputFlags

func BindLoginOutputFlags(cmd *cobra.Command)

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:

func BindLoginRepoFlags

func BindLoginRepoFlags(cmd *cobra.Command)

func BindNotificationFlags

func BindNotificationFlags(cmd *cobra.Command)

func BindPageFlags

func BindPageFlags(cmd *cobra.Command)

func GetListOptions

func GetListOptions() kmup.ListOptions

GetListOptions returns configured paging struct

func Reset

func Reset()

Reset resets all common flag values to empty Prevents flag value pollution between different commands

Types

type CsvFlag

type CsvFlag struct {
	Name            string
	Aliases         []string
	Value           string
	Usage           string
	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

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

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

func NewCsvFlag

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

func (f CsvFlag) GetValues(cmd *cobra.Command) ([]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