Documentation ¶
Index ¶
- Variables
- func Execute()
- type Arg
- type BoolFlag
- type Command
- type CommonArg
- type Context
- func (c *Context) AvailableOrgs() ([]apistructs.OrgDTO, error)
- func (c *Context) CurrentOrg() (apistructs.OrgDTO, error)
- func (c *Context) Delete() *httpclient.Request
- func (c *Context) DevDiceYml(checkExist bool) (string, error)
- func (c *Context) DiceYml(checkExist bool) (string, error)
- func (c *Context) Fail(format string, a ...interface{})
- func (c *Context) Get() *httpclient.Request
- func (c *Context) Patch() *httpclient.Request
- func (c *Context) Post() *httpclient.Request
- func (c *Context) ProdDiceYml(checkExist bool) (string, error)
- func (c *Context) Put() *httpclient.Request
- func (c *Context) StagingDiceYml(checkExist bool) (string, error)
- func (c *Context) Succ(format string, a ...interface{})
- func (c *Context) TestDiceYml(checkExist bool) (string, error)
- type Flag
- type FloatArg
- type FloatFlag
- type IPArg
- type IPFlag
- type IntArg
- type IntFlag
- type Level2
- type Level2Arg
- type Level3
- type Level3Arg
- type Level4
- type Level4Arg
- type Level5
- type Level5Arg
- type Level6
- type Level6Arg
- type OrgInfo
- type Release
- type ReleaseResponse
- type StringArg
- type StringFlag
- type StringListFlag
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "erda-cli", Short: "Erda commandline client", Long: ` _/_/_/_/ _/_/_/ _/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/ `, SilenceUsage: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { ctx.Debug = debugMode logrus.SetOutput(os.Stdout) defer func() { cmd.SilenceErrors = true }() httpOption := []httpclient.OpOption{httpclient.WithCompleteRedirect()} if debugMode { logrus.SetLevel(logrus.DebugLevel) httpOption = append(httpOption, httpclient.WithDebug(os.Stdout)) } else { httpOption = append(httpOption, httpclient.WithLoadingPrint("")) } if strings.HasPrefix(host, "https") { httpOption = append(httpOption, httpclient.WithHTTPS()) } ctx.HttpClient = httpclient.New(httpOption...) if strings.Contains(loginWhiteListCmds, strings.Split(cmd.Use, " ")[0]) { return nil } sessionInfos, err := ensureSessionInfos() if err != nil { err = fmt.Errorf(color_str.Red("✗ ") + err.Error()) fmt.Println(err) return err } ctx.Sessions = sessionInfos return nil }, }
rootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
type Command ¶
type Command struct { // default: rootcmd ParentName string Name string ShortHelp string LongHelp string Example string // dont show up in list of cmds Hidden bool DontHideCursor bool /* args: []Arg { IPArg{}, StringArg{}, BoolArg{}, } */ Args []Arg /* flags: []Flag{ StringFlag{"H", "host", "1.2.3.4", "doc"}, BoolFlag{"A", "another", true, "doc"}, IntFlag{"O", "ohyoyo", 1, "doc"}, } */ Flags []Flag /* actually type: func(ctx Context, arg1 IPArg, arg2 string, arg3 bool, host string, anotherone bool, ohyoyo int) error `host`, `anotherone`, `ohyoyo` is generated by `Flags` */ Run interface{} }
type Context ¶
type Context struct { Sessions map[string]status.StatusInfo CurrentOpenApiHost string Debug bool Token string // uc token HttpClient *httpclient.HTTPClient }
func GetContext ¶
func GetContext() *Context
func (*Context) AvailableOrgs ¶
func (c *Context) AvailableOrgs() ([]apistructs.OrgDTO, error)
func (*Context) CurrentOrg ¶
func (c *Context) CurrentOrg() (apistructs.OrgDTO, error)
当前企业可能不存在,因为可能不在任何企业内,所以返回的OrgInfo可能为空
func (*Context) Delete ¶
func (c *Context) Delete() *httpclient.Request
func (*Context) Get ¶
func (c *Context) Get() *httpclient.Request
func (*Context) Patch ¶
func (c *Context) Patch() *httpclient.Request
func (*Context) Post ¶
func (c *Context) Post() *httpclient.Request
func (*Context) Put ¶
func (c *Context) Put() *httpclient.Request
type Level2 ¶
type Level2 struct {
V [2]string
}
func (Level2) DicePathAble ¶
func (Level2) DicePathAble()
type Level3 ¶
type Level3 struct {
V [3]string
}
func (Level3) DicePathAble ¶
func (Level3) DicePathAble()
type Level4 ¶
type Level4 struct {
V [4]string
}
func (Level4) DicePathAble ¶
func (Level4) DicePathAble()
type Level5 ¶
type Level5 struct {
V [5]string
}
func (Level5) DicePathAble ¶
func (Level5) DicePathAble()
type ReleaseResponse ¶
type StringFlag ¶
func (StringFlag) DefaultV ¶
func (v StringFlag) DefaultV() string
func (StringFlag) Flag ¶
func (StringFlag) Flag()
type StringListFlag ¶
func (StringListFlag) Flag ¶
func (StringListFlag) Flag()
Click to show internal directories.
Click to hide internal directories.