commands

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Root *root

Root handles the commands

Functions

This section is empty.

Types

type Base

type Base struct {
	Config
	Flags mflag.FlagSet
	*api.OnlineAPI
	// contains filtered or unexported fields
}

Base must be embedded in the commands

func (*Base) CheckFlags

func (b *Base) CheckFlags(args []string) (err error)

CheckFlags can be overloaded by the commands to check the flags

func (*Base) ExamplesHelp

func (b *Base) ExamplesHelp() string

ExamplesHelp returns the examples, it used by PrintUsage

func (*Base) Init

func (b *Base) Init(c Config)

Init initiates the Base structure

func (*Base) InitAPI

func (b *Base) InitAPI() (err error)

InitAPI initiates the Online API with the credentials

func (*Base) Options

func (b *Base) Options() string

Options returns the options available, it used by PrintUsage

func (*Base) Parse

func (b *Base) Parse(args []string) (newArgs []string, err error)

Parse parses the argurments

func (*Base) PrintUsage

func (b *Base) PrintUsage()

PrintUsage print on Stdout the usage message

type Command

type Command interface {
	GetName() string
	Parse(args []string) ([]string, error)
	Run(args []string) error
	CheckFlags(args []string) error
	PrintUsage()
}

Command is the interface that is used to handle the commands

func Bucket

func Bucket() Command

func Create

func Create() Command

Create returns a new command "create"

func Download

func Download() Command

Upload returns a new command "upload"

func Files

func Files() Command

Files returns a new command "files"

func Freeze

func Freeze() Command

Freeze returns a new command "freeze"

func Help

func Help() Command

Help returns a new command "help"

func Login

func Login() Command

Login returns a new command "login"

func Ls

func Ls() Command

Ls returns a new command "ls"

func Migrate

func Migrate() Command

Migrate returns a new command "migrate"

func Remove

func Remove() Command

Remove returns a new command "remove"

func Rename

func Rename() Command

Rename returns a new command "rename"

func Unfreeze

func Unfreeze() Command

Unfreeze returns a new command "unfreeze"

func Upload

func Upload() Command

Upload returns a new command "upload"

func Verify

func Verify() Command

Verify returns a new command "verify"

func Version

func Version() Command

type Config

type Config struct {
	UsageLine   string
	Description string
	Help        string
	Examples    string
}

Config represents the informations on the usages

type Env

type Env struct {
	Debug   bool
	Verbose bool
}

Env containts the global options

type Streams

type Streams struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
}

Streams allows to overload the output and input

Jump to

Keyboard shortcuts

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