cmdUtils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountFromFlag

func AccountFromFlag(cmd *cobra.Command) (acc accounts.Account)

AccountFromFlag returns the account based on the flag

func AccountFromFlagOrAsk

func AccountFromFlagOrAsk(cmd *cobra.Command, message string) (acc accounts.Account)

AccountFromFlagOrAsk return the selected account either by reading the flag value or by asking to the user

func Accountable

func Accountable(cmd *cobra.Command)

Accountable mark a command as Accountable so will have the --account flag

func AskAccount

func AskAccount(message string) (acc accounts.Account)

AskAccount asks to the user to select an account

func Confirm

func Confirm(cmd *cobra.Command, message string) (confirmed bool)

Confirm checks that the flag "confirm" is set and otherwise ask a confirmation in the command line

func Confirmable

func Confirmable(cmd *cobra.Command)

Confirmable marks a command as confirmable so will have the --confirm flag

func FindAccount

func FindAccount(accountValue string) (acc accounts.Account)

FindAccount returns an account if it matches either the address or the name

func GetOrAskAmount

func GetOrAskAmount(cmd *cobra.Command, message string) (amount *conversion.Amount, err error)

GetOrAskAmount return the amount in MESG based on the flag or the user input

func Payable

func Payable(cmd *cobra.Command)

Payable mark a command as payable

func ShowSpinnerForFunc

func ShowSpinnerForFunc(opts SpinnerOptions, function func())

ShowSpinnerForFunc shows a spinner during the execution of the function

func StartSpinner

func StartSpinner(opts SpinnerOptions) (spinner *spinnerPkg.Spinner)

StartSpinner create a new spinner for the terminal

func WaitForCancel

func WaitForCancel() (abort chan os.Signal)

WaitForCancel create a chan than is resolved when the user press CTRL+C

Types

type SpinnerOptions

type SpinnerOptions struct {
	Text  string
	Color string
}

SpinnerOptions is a struct that contains all details for the spinner

Jump to

Keyboard shortcuts

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