v0.0.0-...-1f45761 Latest Latest

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0




This section is empty.


This section is empty.


func AddCommand

func AddCommand(cmd *Command)

AddCommand adds a command to internal list

func Login

func Login(r *Request) (string, error)

Login logs in a user based on provided request and returns http client and session key

func NewAPIRequest

func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[string]interface{}, error)

NewAPIRequest makes an API request to configured management server

func PrintUsage

func PrintUsage()

PrintUsage prints help usage for a command


type Command

type Command struct {
	Name            string
	Help            string
	SubCommands     map[string][]string
	CustomCompleter func(input string, position int)
	Handle          func(*Request) error

Command describes a CLI command

func AllCommands

func AllCommands() []*Command

AllCommands returns all available commands

func FindCommand

func FindCommand(name string) *Command

FindCommand finds command handler for a command string

func GetAPIHandler

func GetAPIHandler() *Command

GetAPIHandler returns a catchall command handler

type Request

type Request struct {
	Command *Command
	Config  *config.Config
	Args    []string

Request describes a command request

func NewRequest

func NewRequest(cmd *Command, cfg *config.Config, args []string) *Request

NewRequest creates a new request from a command

func (*Request) Client

func (r *Request) Client() *http.Client

Client method returns the http Client for the current server profile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL