Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RootPage = appKind Shortcuts = [][]string{ {"Key c", "Create"}, {"Key i", "Inspect"}, {"Key e", "Edit"}, {"Key d", "Delete"}, {"Key l", "Logs"}, {"Key x", "Exec"}, {"Key p", "View Pods"}, {"Key v", "View revision"}, {"Key /", "Search"}, {"Key Ctrl+h", "Hit Endpoint"}, {"Key Ctrl+r", "Refresh"}, {"Key Ctrl+s", "Show system resource"}, } { Title: "Apps", Kind: appKind, Index: 1, }, { Title: "Routes", Kind: routeKind, Index: 2, }, { Title: "ExternalService", Kind: externalServiceKind, Index: 3, }, { Title: "PublicDomain", Kind: publicdomainKind, Index: 4, }, { Title: "Config", Kind: configKind, Index: 5, }, { Title: "Build", Kind: buildKind, Index: 6, }, } '1': appKind, '2': routeKind, '3': externalServiceKind, '4': publicdomainKind, '5': configKind, '6': buildKind, } App = types.ResourceKind{ Title: "Apps", Kind: appKind, } Route = types.ResourceKind{ Title: "Routers", Kind: routeKind, } Config = types.ResourceKind{ Title: "Configs", Kind: configKind, } PublicDomain = types.ResourceKind{ Title: "PublicDomains", Kind: publicdomainKind, } Service = types.ResourceKind{ Title: "Services", Kind: serviceKind, } ExternalService = types.ResourceKind{ Title: "ExternalServices", Kind: externalServiceKind, } Pod = types.ResourceKind{ Title: "Pods", Kind: podKind, } Build = types.ResourceKind{ Title: "Builds", Kind: buildKind, } DefaultAction = []types.Action{ { Name: "Inspect", Shortcut: "I", Description: "inspect a resource", }, { Name: "Edit", Shortcut: "E", Description: "edit a resource", }, { Name: "Delete", Shortcut: "Del", Description: "delete a resource", }, { Name: "Exec", Shortcut: "X", Description: "exec into a container or service", }, { Name: "Revisions", Shortcut: "R", Description: "view revisions of a app", }, { Name: "Log", Shortcut: "L", Description: "view logs of a service", }, { Name: "Pods", Shortcut: "P", Description: "view pods of a service or app", }, { Name: "Hit", Shortcut: "Ctrl+H", Description: "hit endpoint of a service(need jq and curl)", }, { Name: "Refresh", Shortcut: "Ctrl+R", Description: "Refresh Page", }, { Name: "ShowSystem", Shortcut: "S", Description: "Show system resource", }, { Name: "Escape", Shortcut: "Esc", Description: "Go to the previous level", }, { Name: "Quit", Shortcut: "Q", Description: "Quit console", }, } ViewMap = map[string]types.View{ // contains filtered or unexported fields } )
View Source
var ( ConfigRefresher = func(b *bytes.Buffer) error { args := []string{"config"} if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } PublicDomainRefresher = func(b *bytes.Buffer) error { args := []string{"domain"} if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } ExternalRefresher = func(b *bytes.Buffer) error { args := []string{"external"} if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } RouteRefresher = func(b *bytes.Buffer) error { args := []string{"route"} if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } AppRefresher = func(b *bytes.Buffer) error { args := []string{"ps"} if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } ServiceRefresher = func(b *bytes.Buffer) error { args := []string{"revision"} if *servicePrefix != "" { args = append(args, *servicePrefix) } if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } PodRefresher = func(b *bytes.Buffer) error { args := []string{"ps", "-c"} if *podPrefix != "" { args = append(args, *podPrefix) } if showSystem { args = append([]string{"--system"}, args...) } cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } BuildRefresher = func(b *bytes.Buffer) error { args := []string{"build"} cmd := reexec.Command(append([]string{"rio"}, args...)...) errBuffer := &strings.Builder{} cmd.Env = append(os.Environ(), "FORMAT=raw") cmd.Stdout = b cmd.Stderr = errBuffer if err := cmd.Run(); err != nil { return errors.New(errBuffer.String()) } return nil } )
Refresher refreshes the data by invoking the defined functions. Right now refreshers are invoked by shell output, but it can customized by override buffer writer.
Functions ¶
This section is empty.
Types ¶
type Console ¶
type Console struct {
Refresh string `desc:"refresh based on polling or controller (polling|controller)"`
}
func (*Console) Run ¶
func (t *Console) Run(ctx *clicontext.CLIContext) error
Click to show internal directories.
Click to hide internal directories.