Documentation ¶
Index ¶
- Variables
- func CredentialsPath(ctx context.Context) (*string, error)
- func Login(ctx context.Context, address string, password string) error
- func Logout(ctx context.Context) error
- func WithCredentials(ctx context.Context, credentials *Credentials) context.Context
- type Cli
- type CmdName
- type Command
- type ContextKey
- type Credentials
- type Mint
Constants ¶
This section is empty.
Variables ¶
var Registrar = map[CmdName](func() Command){}
Registrar is used to register command generators within the module.
Functions ¶
func CredentialsPath ¶
CredentialsPath returns the crendentials path for the current environment.
func WithCredentials ¶
func WithCredentials( ctx context.Context, credentials *Credentials, ) context.Context
WithCredentials stores the credentials in the provided context.
Types ¶
type Cli ¶
Cli represents a cli instance.
type Command ¶
type Command interface { // Name returns the command name. Name() CmdName // Help prints out the help message for the command. Help(context.Context) // Parse the arguments passed to the command. Parse(context.Context, []string) error // Execute the command or return a human-friendly error. Execute(context.Context) error }
Command is the interface for a cli command.
type ContextKey ¶
type ContextKey string
ContextKey is the type of the key used with context to contextual data.
type Credentials ¶
type Credentials struct { Username string `json:"username"` Host string `json:"mint"` Password string `json:"password"` }
Credentials rerpesents the credentials of the currently logged in user.
func CurrentUser ¶
func CurrentUser( ctx context.Context, ) (*Credentials, error)
CurrentUser retrieves the current user by reading CredentialsPath.
func GetCredentials ¶
func GetCredentials( ctx context.Context, ) *Credentials
GetCredentials returns the credentials currently stored in the context.
type Mint ¶
type Mint struct { Host string Credentials *Credentials }
Mint represents a mint
func MintFromContextCredentials ¶
MintFromContextCredentials returns a mint object from the credentials stored in the current context.