git-bug: github.com/MichaelMure/git-bug/input Index | Files

package input

import "github.com/MichaelMure/git-bug/input"

Package input contains helpers to use a text editor as an input for various field of a bug

Index

Package Files

input.go prompt.go

Variables

var ErrEmptyMessage = errors.New("empty message")

ErrEmptyMessage is returned when the required message has not been entered

var ErrEmptyTitle = errors.New("empty title")

ErrEmptyMessage is returned when the required title has not been entered

func BugCommentEditorInput Uses

func BugCommentEditorInput(repo repository.RepoCommon, preMessage string) (string, error)

BugCommentEditorInput will open the default editor in the terminal with a template for the user to fill. The file is then processed to extract a comment.

func BugCommentFileInput Uses

func BugCommentFileInput(fileName string) (string, error)

BugCommentFileInput read from either from a file or from the standard input and extract a message

func BugCreateEditorInput Uses

func BugCreateEditorInput(repo repository.RepoCommon, preTitle string, preMessage string) (string, string, error)

BugCreateEditorInput will open the default editor in the terminal with a template for the user to fill. The file is then processed to extract title and message.

func BugCreateFileInput Uses

func BugCreateFileInput(fileName string) (string, string, error)

BugCreateFileInput read from either from a file or from the standard input and extract a title and a message

func BugTitleEditorInput Uses

func BugTitleEditorInput(repo repository.RepoCommon, preTitle string) (string, error)

BugTitleEditorInput will open the default editor in the terminal with a template for the user to fill. The file is then processed to extract a title.

func IsURL Uses

func IsURL(name string, value string) (string, error)

IsURL is a validator checking that the value is a fully formed URL

func Prompt Uses

func Prompt(prompt, name string, validators ...PromptValidator) (string, error)

Prompt is a simple text input.

func PromptChoice Uses

func PromptChoice(prompt string, choices []string) (int, error)

PromptChoice is a prompt giving possible choices Return the index starting at zero of the choice selected.

func PromptCredential Uses

func PromptCredential(target, name string, credentials []auth.Credential, choices []string) (auth.Credential, int, error)

func PromptDefault Uses

func PromptDefault(prompt, name, preValue string, validators ...PromptValidator) (string, error)

PromptDefault is a simple text input with a default value.

func PromptPassword Uses

func PromptPassword(prompt, name string, validators ...PromptValidator) (string, error)

PromptPassword is a specialized text input that doesn't display the characters entered.

func PromptURLWithRemote Uses

func PromptURLWithRemote(prompt, name string, validRemotes []string, validators ...PromptValidator) (string, error)

func QueryEditorInput Uses

func QueryEditorInput(repo repository.RepoCommon, preQuery string) (string, error)

QueryEditorInput will open the default editor in the terminal with a template for the user to fill. The file is then processed to extract a query.

func Required Uses

func Required(name string, value string) (string, error)

Required is a validator preventing a "" value

type PromptValidator Uses

type PromptValidator func(name string, value string) (complaint string, err error)

PromptValidator is a validator for a user entry If complaint is "", value is considered valid, otherwise it's the error reported to the user If err != nil, a terminal error happened

Package input imports 18 packages (graph) and is imported by 8 packages. Updated 2020-03-09. Refresh now. Tools for package owners.