cui

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stdin is exported for tests
	Stdin io.Reader = os.Stdin
	// Stdout is exported for tests
	Stdout io.Writer = os.Stdout
	// Stderr is exported for tests
	Stderr io.Writer = os.Stderr
)

Functions

func AskForGitConfigUser

func AskForGitConfigUser(ctx context.Context, crypto backend.Crypto, name string) (string, string, error)

AskForGitConfigUser will iterate over GPG private key identities and prompt the user for selecting one identity whose name and email address will be used as git config user.name and git config user.email, respectively. On error or no selection, name and email will be empty. If s.isTerm is false (i.e., the user cannot be prompted), however, the first identity's name/email pair found is returned.

func AskForPrivateKey

func AskForPrivateKey(ctx context.Context, crypto backend.Crypto, name, prompt string) (string, error)

AskForPrivateKey promts the user to select from a list of private keys

func AskForStore

func AskForStore(ctx context.Context, s mountPointer) string

AskForStore shows a store / mount point selection

func ConfirmRecipients

func ConfirmRecipients(ctx context.Context, crypto backend.Crypto, name string, recipients []string) ([]string, error)

ConfirmRecipients asks the user to confirm a given set of recipients

func GetSelection

func GetSelection(ctx context.Context, prompt, usage string, choices []string) (string, int)

GetSelection show a navigateable multiple-choice list to the user and returns the selected entry along with the action

Types

type Action

type Action struct {
	Name string
	Fn   func(context.Context, *cli.Context) error
}

Action is a action which can be selected

type Actions

type Actions []Action

Actions is a list of actions

func (Actions) Run

func (ca Actions) Run(ctx context.Context, c *cli.Context, i int) error

Run executes the selected action

func (Actions) Selection

func (ca Actions) Selection() []string

Selection return the list of actions

Jump to

Keyboard shortcuts

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