Documentation
¶
Index ¶
- Constants
- func ExecuteRootCmd(rootCmd *Cmd)
- func ProjectScopeReset(cmdData *LoggedUserCmdData) error
- type ArgOption
- type Cmd
- func (c *Cmd) AddChildrenCmd(childrenCmd *Cmd) *Cmd
- func (c *Cmd) Arg(name string, auxOptions ...ArgOption) *Cmd
- func (c *Cmd) BoolFlag(name string, defaultValue bool, description string, auxOptions ...FlagOption) *Cmd
- func (c *Cmd) GuestRunFunc(runFunc guestRunFunc) *Cmd
- func (c *Cmd) HelpFlag(description string, auxOptions ...FlagOption) *Cmd
- func (c *Cmd) IntFlag(name string, defaultValue int, description string, auxOptions ...FlagOption) *Cmd
- func (c *Cmd) LoggedUserRunFunc(runFunc loggedUserRunFunc) *Cmd
- func (c *Cmd) Long(long string) *Cmd
- func (c *Cmd) ScopeLevel(scopeLevel ScopeLevel) *Cmd
- func (c *Cmd) SetHelpTemplate(template string) *Cmd
- func (c *Cmd) Short(short string) *Cmd
- func (c *Cmd) SilenceError(silenceError bool) *Cmd
- func (c *Cmd) SilenceUsage(silenceUsage bool) *Cmd
- func (c *Cmd) StringFlag(name string, defaultValue string, description string, auxOptions ...FlagOption) *Cmd
- func (c *Cmd) StringSliceFlag(name string, defaultValue []string, description string, ...) *Cmd
- func (c *Cmd) Use(use string) *Cmd
- type FlagOption
- type GuestCmdData
- type LoggedUserCmdData
- type ProjectOption
- type ScopeLevel
- type ServiceOption
Constants ¶
View Source
const ProjectArgName = "project-id"
View Source
const ServiceArgName = "service-id-or-name"
Variables ¶
This section is empty.
Functions ¶
func ExecuteRootCmd ¶ added in v1.0.5
func ExecuteRootCmd(rootCmd *Cmd)
func ProjectScopeReset ¶ added in v1.0.46
func ProjectScopeReset(cmdData *LoggedUserCmdData) error
Types ¶
type ArgOption ¶
type ArgOption = func(cfg *cmdArg)
func OptionalArg ¶
func OptionalArg() ArgOption
func OptionalArgLabel ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func (*Cmd) AddChildrenCmd ¶
func (*Cmd) GuestRunFunc ¶
func (*Cmd) LoggedUserRunFunc ¶
func (*Cmd) ScopeLevel ¶
func (c *Cmd) ScopeLevel(scopeLevel ScopeLevel) *Cmd
func (*Cmd) SetHelpTemplate ¶ added in v1.0.5
func (*Cmd) SilenceError ¶ added in v1.0.8
func (*Cmd) SilenceUsage ¶
func (*Cmd) StringFlag ¶
func (*Cmd) StringSliceFlag ¶ added in v1.0.46
type FlagOption ¶
type FlagOption = func(cfg *cmdFlag)
func HiddenFlag ¶
func HiddenFlag() FlagOption
func ShortHand ¶
func ShortHand(shorthand string) FlagOption
type GuestCmdData ¶
type GuestCmdData struct {
CliStorage *cliStorage.Handler
UxBlocks *uxBlock.Blocks
Args map[string][]string
Params flagParams.ParamsReader
Stdout printer.Printer
Stderr printer.Printer
PrintHelp func()
}
type LoggedUserCmdData ¶
type LoggedUserCmdData struct {
*GuestCmdData
RestApiClient *zeropsRestApiClient.Handler
// optional params
Project optional.Null[entity.Project]
Service optional.Null[entity.Service]
ProjectSelector func(context.Context, *LoggedUserCmdData, ...uxHelpers.ProjectSelectorOption) (entity.Project, bool, error)
VpnKeys map[uuid.ProjectId]entity.VpnKey
}
type ProjectOption ¶ added in v1.0.46
func WithCreateNewProject ¶ added in v1.0.46
func WithCreateNewProject() ProjectOption
WithCreateNewProject allows 'create new project' option in selector
func WithSkipSelectProject ¶ added in v1.0.49
func WithSkipSelectProject() ProjectOption
WithSkipSelectProject allows skip project select
type ScopeLevel ¶
type ScopeLevel interface {
AddCommandFlags(*Cmd)
LoadSelectedScope(ctx context.Context, cmd *Cmd, cmdData *LoggedUserCmdData) error
}
func ScopeProject ¶ added in v1.0.46
func ScopeProject(opts ...ProjectOption) ScopeLevel
func ScopeService ¶ added in v1.0.46
func ScopeService(opts ...ServiceOption) ScopeLevel
type ServiceOption ¶ added in v1.0.46
func WithCreateNewService ¶ added in v1.0.46
func WithCreateNewService() ServiceOption
WithCreateNewService allows 'create new service' option in selector
func WithProjectScopeOptions ¶ added in v1.0.46
func WithProjectScopeOptions(opts ...ProjectOption) ServiceOption
Click to show internal directories.
Click to hide internal directories.