session

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrinterLogLevelInfo  PrinterLogLevel = "info"
	PrinterLogLevelDebug                 = "debug"
	PrinterLogLevelError                 = "error"
)

Variables

View Source
var KeybaseName = "akash"

KeybaseName is the default name of the Keybase

Functions

func AddFlagHost added in v0.2.4

func AddFlagHost(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagKey

func AddFlagKey(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagKeyOptional added in v0.3.0

func AddFlagKeyOptional(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagKeyType

func AddFlagKeyType(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagNode

func AddFlagNode(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagNonce

func AddFlagNonce(cmd *cobra.Command, flags *pflag.FlagSet)

func AddFlagWait

func AddFlagWait(cmd *cobra.Command, flags *pflag.FlagSet)

func SetupBaseCommand

func SetupBaseCommand(cmd *cobra.Command)

func WithSession

func WithSession(fn Runner) cmdRunner

Types

type IPrinter added in v0.4.3

type IPrinter interface {
	// AddTitle adds a title with the given string and
	// returns the instance of IPrinter with the title
	AddTitle(string) IPrinter

	// AddText adds a text component with the given string and
	// returns the instance of IPrinter with the text
	AddText(string) IPrinter

	// Add adds the components to the printer
	Add(UIComponent) IPrinter

	// Flush prints the output to the writer and clears the buffer
	Flush() error

	// Bytes returns the formmated string of the output
	Bytes() []byte
}

func NewIPrinter added in v0.4.3

func NewIPrinter(out io.Writer) IPrinter

NewIPrinter returns a pointer to a new printer object

type NoKeysForDefaultError added in v0.4.3

type NoKeysForDefaultError struct{}

func (NoKeysForDefaultError) Error added in v0.4.3

func (e NoKeysForDefaultError) Error() string

type Printer added in v0.4.3

type Printer interface {
	Flush() error
	Data() *PrinterData
}

func NewJSONPrinter added in v0.4.3

func NewJSONPrinter(data *PrinterData, out io.Writer) Printer

func NewTextPrinter added in v0.4.3

func NewTextPrinter(data *PrinterData, out io.Writer) Printer

type PrinterData added in v0.4.3

type PrinterData struct {
	Result []map[string]string `json:"result,omitempty"`
	Raw    interface{}         `json:"raw,omitempty"`
	Log    []PrinterLog        `json:"log,omitempty"`
	// contains filtered or unexported fields
}

func NewPrinterDataKV added in v0.4.3

func NewPrinterDataKV() *PrinterData

func NewPrinterDataList added in v0.4.3

func NewPrinterDataList() *PrinterData

func (*PrinterData) AddResultKV added in v0.4.3

func (d *PrinterData) AddResultKV(key, value string) *PrinterData

func (*PrinterData) AddResultList added in v0.4.3

func (d *PrinterData) AddResultList(results ...PrinterResult) *PrinterData

func (*PrinterData) ResultMode added in v0.4.3

func (d *PrinterData) ResultMode() PrinterResultMode

type PrinterLog added in v0.4.3

type PrinterLog struct {
	Timestamp time.Time
	Message   interface{}
	Level     PrinterLogLevel
}

type PrinterLogLevel added in v0.4.3

type PrinterLogLevel string

type PrinterResult added in v0.4.3

type PrinterResult map[string]string

type PrinterResultMode added in v0.4.3

type PrinterResultMode uint
const (
	PrinterResultModeKV PrinterResultMode = iota
	PrinterResultModeList
)

type Runner

type Runner func(sess Session, cmd *cobra.Command, args []string) error

func RequireHost added in v0.2.4

func RequireHost(fn Runner) Runner

func RequireKey

func RequireKey(fn Runner) Runner

func RequireKeyManager

func RequireKeyManager(fn Runner) Runner

func RequireNode

func RequireNode(fn Runner) Runner

func RequireRootDir

func RequireRootDir(fn Runner) Runner

func WithPrinter added in v0.4.0

func WithPrinter(fn Runner) Runner

type Session

type Session interface {
	RootDir() string
	KeyManager() (keys.Keybase, error)
	Node() string
	Client() *tmclient.HTTP
	TxClient() (txutil.Client, error)
	QueryClient() query.Client
	KeyName() string
	KeyType() (keys.SigningAlgo, error)
	Key() (keys.Info, error)
	Nonce() (uint64, error)
	Log() log.Logger
	Signer() (txutil.Signer, keys.Info, error)
	Ctx() context.Context
	NoWait() bool
	Host() string
	Password() (string, error)
	Printer() uiutil.Printer
	Mode() dsky.Mode
	ULog() ULog
}

type TooManyKeysForDefaultError added in v0.4.3

type TooManyKeysForDefaultError struct{ KeysCount int }

func (*TooManyKeysForDefaultError) Error added in v0.4.3

type UIComponent added in v0.4.3

type UIComponent interface {
	Bytes() []byte
}

UIComponent in the interface that UI components need to implement

type ULog added in v0.4.3

type ULog interface {
	Error(msg interface{})
	Success(msg interface{})
}

func NewUlogger added in v0.4.3

func NewUlogger(s Session) ULog

Jump to

Keyboard shortcuts

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