cmd

package
v0.0.0-...-531d8da Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func PromptAndUploadFilesIfNeeded

func PromptAndUploadFilesIfNeeded(r *Request, api string, response map[string]interface{})

PromptAndUploadFilesIfNeeded prompts the user to provide file paths for upload and the API is getUploadParamsFor*

func UploadFiles

func UploadFiles(r *Request, api string, response map[string]interface{}, validFiles []string)

UploadFiles uploads files to a remote server using parameters from the API response. Shows progress for each file and reports any failures.

func ValidateAndGetFileList

func ValidateAndGetFileList(filePaths string) ([]string, error)

ValidateAndGetFileList parses a comma-separated string of file paths, trims them, checks for existence, and returns a slice of valid file paths or an error if any are missing.

Types

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
	CredentialsSupplied bool
}

Request describes a command request

func NewRequest

func NewRequest(cmd *Command, cfg *config.Config, args []string, credentialsSupplied bool) *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