cui

package
v1.15.15 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 13 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) (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, prompt string) (string, error)

AskForPrivateKey prompts 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 GetSelection

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

GetSelection show a navigable 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