cli

package
v0.0.0-...-036eace Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAssetsPathNotSet = errors.New("Assets path is not set")

ErrAssetsPathNotSet reported error when tried to use the cli tool before setting a local assets path

View Source
var (
	// ErrEmptyRemotesCfgPath returned when tried to access remotes config permament storage
	// before providing a path for it
	ErrEmptyRemotesCfgPath = errors.New("Remotes configuration file path is not set")
)

Functions

func AskBool

func AskBool(question string, defaultAnswer string) bool

AskBool asks a question and expect a yes/no answer.

func ConfirmDeletion

func ConfirmDeletion(what string, deletableItems []string) error

ConfirmDeletion prints out a question about removing resources and returns error if 'yes' is not replied

func DumpData

func DumpData(format string, data interface{}) error

DumpData prints out data in yaml or json format, as desired

func NewClient

func NewClient() (client.Client, error)

NewClient returns a REST client pointing to the default remote

func PrintResources

func PrintResources(resources map[string][]string)

PrintResources prints out a list of resources, in a well formatted list one per row and padded

func SetAssetsPath

func SetAssetsPath(path string) error

SetAssetsPath sets the local path to store cli tool configuration files, certificates an any needed stuff. Triggers the initial configuration setup

func ShowProgressBar

func ShowProgressBar(ctx context.Context, summary string, max float64, sent chan float64, op func(ctx context.Context) error) error

ShowProgressBar prints out a progress bar in console while op function is being executed. A 'max' value and 'sent' channel parameters are needed to visually progress the bar

func ShowProgressSpin

func ShowProgressSpin(ctx context.Context, summary string, op func(ctx context.Context) error) error

ShowProgressSpin prints out a rotating spin in console while the op function is being executed

Types

type RemoteActivateCmd

type RemoteActivateCmd struct {
	Args struct {
		Name string `positional-arg-name:"name"`
	} `positional-args:"yes" required:"yes"`
}

RemoteActivateCmd sets the remote endpoint to use from this client

func (*RemoteActivateCmd) Execute

func (cmd *RemoteActivateCmd) Execute(args []string) error

Execute sets the active remote

type RemoteAddCmd

type RemoteAddCmd struct {
	Args struct {
		Name string `positional-arg-name:"name" required:"yes"`
		URL  string `positional-arg-name:"url" required:"yes"`
	} `positional-args:"yes"`
	AcceptCertificate bool `long:"accept-certificate" description:"Implicit accepts remote server certificate if https"`
}

RemoteAddCmd adds a new remote

func (*RemoteAddCmd) Execute

func (cmd *RemoteAddCmd) Execute(args []string) error

Execute adds a new remote

type RemoteCommand

type RemoteCommand struct {
	List     RemoteListCmd     `command:"list" alias:"ls" description:"List available remotes"`
	Add      RemoteAddCmd      `command:"add" description:"Add a new remote"`
	Remove   RemoteRemoveCmd   `command:"remove" description:"Remove a remote"`
	Activate RemoteActivateCmd `command:"activate" description:"Set active remote"`
	SetURL   RemoteSetURLCmd   `command:"set-url" description:"Set url of an existing remote"`
}

RemoteCommand is the command for AMS remote management

type RemoteListCmd

type RemoteListCmd struct {
	Format string `long:"format" description:"Output format (table|json)" default:"table"`
}

RemoteListCmd lists available remotes

func (*RemoteListCmd) Execute

func (cmd *RemoteListCmd) Execute(args []string) error

Execute lists all currently configured remotes

type RemoteRemoveCmd

type RemoteRemoveCmd struct {
	Args struct {
		Name string `positional-arg-name:"name"`
	} `positional-args:"yes" required:"yes"`
}

RemoteRemoveCmd removes an existing remote

func (*RemoteRemoveCmd) Execute

func (cmd *RemoteRemoveCmd) Execute(args []string) error

Execute removes an existing remote

type RemoteSetURLCmd

type RemoteSetURLCmd struct {
	Args struct {
		Name string `positional-arg-name:"name"`
		URL  string `positional-arg-name:"url"`
	} `positional-args:"yes" required:"yes"`
}

RemoteSetURLCmd sets the URL of a existing remote

func (*RemoteSetURLCmd) Execute

func (cmd *RemoteSetURLCmd) Execute(args []string) error

Execute sets the URL of a existing remote

type RemotesCfg

type RemotesCfg struct {
	Active     string            `yaml:"default-remote,omitempty"`
	Availables map[string]string `yaml:"remotes,omitempty"`
	// contains filtered or unexported fields
}

RemotesCfg contains the remotes configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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