Documentation
¶
Overview ¶
Package input contains helpers to use a text editor as an input for various field of a bug
Index ¶
- func FromFile(fileName string) (string, error)
- func IsURL(name string, value string) (string, error)
- func LaunchEditor(repo repository.RepoCommonStorage, fileName string) (string, error)
- func LaunchEditorWithTemplate(repo repository.RepoCommonStorage, fileName string, template string) (string, error)
- func Prompt(prompt, name string, validators ...PromptValidator) (string, error)
- func PromptChoice(prompt string, choices []string) (int, error)
- func PromptCredential(target, name string, credentials []auth.Credential, choices []string) (auth.Credential, int, error)
- func PromptDefault(prompt, name, preValue string, validators ...PromptValidator) (string, error)
- func PromptPassword(prompt, name string, validators ...PromptValidator) (string, error)
- func PromptURLWithRemote(prompt, name string, validRemotes []string, validators ...PromptValidator) (string, error)
- func Required(name string, value string) (string, error)
- type PromptValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromFile ¶
FromFile loads and returns the contents of a given file. If - is passed through, much like git, it will read from stdin. This can be piped data, unless there is a tty in which case the user will be prompted to enter a message.
func LaunchEditor ¶
func LaunchEditor(repo repository.RepoCommonStorage, fileName string) (string, error)
LaunchEditor launches the default editor configured for the given repo. This method blocks until the editor command has returned.
The specified filename should be a temporary file and provided as a relative path from the repo (e.g. "FILENAME" will be converted to "[<reporoot>/].git/git-bug/FILENAME"). This file will be deleted after the editor is closed and its contents have been read.
This method returns the text that was read from the temporary file, or an error if any step in the process failed.
func LaunchEditorWithTemplate ¶
func LaunchEditorWithTemplate(repo repository.RepoCommonStorage, fileName string, template string) (string, error)
LaunchEditorWithTemplate will launch an editor as LaunchEditor do, but with a provided template.
func Prompt ¶
func Prompt(prompt, name string, validators ...PromptValidator) (string, error)
Prompt is a simple text input.
func PromptChoice ¶
PromptChoice is a prompt giving possible choices Return the index starting at zero of the choice selected.
func PromptCredential ¶
func PromptCredential(target, name string, credentials []auth.Credential, choices []string) (auth.Credential, int, error)
func PromptDefault ¶
func PromptDefault(prompt, name, preValue string, validators ...PromptValidator) (string, error)
PromptDefault is a simple text input with a default value.
func PromptPassword ¶
func PromptPassword(prompt, name string, validators ...PromptValidator) (string, error)
PromptPassword is a specialized text input that doesn't display the characters entered.
func PromptURLWithRemote ¶
func PromptURLWithRemote(prompt, name string, validRemotes []string, validators ...PromptValidator) (string, error)