Documentation
¶
Index ¶
- Constants
- Variables
- func AddVerbCmd(flagGrouping *FlagGrouping, parentResourceCmd *cobra.Command, ...)
- func AddVerbCmds(flagGrouping *FlagGrouping, parentResourceCmd *cobra.Command, ...)
- func GetNameArg(args []string, errMsg string) (string, error)
- func GetNameArgs(args []string, check func(args []string) error) ([]string, error)
- func NewPulsarClient() pulsar.Client
- func NewPulsarClientWithAPIVersion(version pulsar.APIVersion) pulsar.Client
- func NewResourceCmd(use, short, long string, aliases ...string) *cobra.Command
- func PrintError(w io.Writer, err error)
- func PrintJSON(w io.Writer, obj interface{})
- func RunFuncWithTimeout(task func([]string, interface{}) bool, condition bool, timeout time.Duration, ...) error
- type ClusterConfig
- type FlagGrouping
- type NamedFlagSetGroup
- type VerbCmd
- func (vc *VerbCmd) SetDescription(use, short, long, example string, aliases ...string)
- func (vc *VerbCmd) SetRunFunc(cmd func() error)
- func (vc *VerbCmd) SetRunFuncWithMultiNameArgs(cmd func() error, checkArgs func(args []string) error)
- func (vc *VerbCmd) SetRunFuncWithNameArg(cmd func() error, errMsg string)
Constants ¶
const IncompatibleFlags = "cannot be used at the same time"
Variables ¶
var CheckNameArgError = defaultNameArgsError
var ExecErrorHandler = defaultExecErrorHandler
var PulsarCtlConfig = ClusterConfig{}
Functions ¶
func AddVerbCmd ¶
func AddVerbCmd(flagGrouping *FlagGrouping, parentResourceCmd *cobra.Command, newVerbCmd func(*VerbCmd))
AddVerbCmd create a registers a new command under the given resource command
func AddVerbCmds ¶
func AddVerbCmds(flagGrouping *FlagGrouping, parentResourceCmd *cobra.Command, newVerbCmd ...func(cmd *VerbCmd))
func GetNameArg ¶
GetNameArg tests to ensure there is only 1 name argument
func GetNameArgs ¶
func NewPulsarClient ¶
func NewPulsarClientWithAPIVersion ¶
func NewPulsarClientWithAPIVersion(version pulsar.APIVersion) pulsar.Client
func NewResourceCmd ¶
NewVerbCmd defines a standard resource command
func PrintError ¶
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { // the web service url that pulsarctl connects to. Default is http://localhost:8080 WebServiceURL string // Set the path to the trusted TLS certificate file TLSTrustCertsFilePath string // Configure whether the Pulsar client accept untrusted TLS certificate from broker (default: false) TLSAllowInsecureConnection bool AuthParams string // Token and TokenFile is used to config the pulsarctl using token to authentication Token string TokenFile string }
the configuration of the cluster that pulsarctl connects to
func (*ClusterConfig) Client ¶
func (c *ClusterConfig) Client(version pulsar.APIVersion) pulsar.Client
func (*ClusterConfig) FlagSet ¶
func (c *ClusterConfig) FlagSet() *pflag.FlagSet
type FlagGrouping ¶
type FlagGrouping struct {
// contains filtered or unexported fields
}
FlagGrouping holds a superset of all flagsets for all commands
func (*FlagGrouping) New ¶
func (g *FlagGrouping) New(cmd *cobra.Command) *NamedFlagSetGroup
New creates a new group of flagsets for use with a subcommand
type NamedFlagSetGroup ¶
type NamedFlagSetGroup struct {
// contains filtered or unexported fields
}
NamedFlagSetGroup holds a single group of flagsets
func (*NamedFlagSetGroup) AddTo ¶
func (n *NamedFlagSetGroup) AddTo(cmd *cobra.Command)
AddTo mixes all flagsets in the given group to another flagset
type VerbCmd ¶
type VerbCmd struct { Command *cobra.Command FlagSetGroup *NamedFlagSetGroup NameArg string NameArgs []string // for testing NameError error }
VerbCmd holds attributes that most of the commands use
func (*VerbCmd) SetDescription ¶
SetDescription sets usage along with short and long descriptions as well as aliases
func (*VerbCmd) SetRunFunc ¶
SetRunFunc registers a command function
func (*VerbCmd) SetRunFuncWithMultiNameArgs ¶
func (*VerbCmd) SetRunFuncWithNameArg ¶
SetRunFuncWithNameArg registers a command function with an optional name argument