input

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

ErrEmptyMessage is returned when the required message has not been entered

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

ErrEmptyMessage is returned when the required title has not been entered

Functions

func BugCommentEditorInput

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

func BugCommentFileInput(fileName string) (string, error)

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

func BugCreateEditorInput

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

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

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

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

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

func Prompt

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

Prompt is a simple text input.

func PromptChoice

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

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)

func QueryEditorInput

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

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

Required is a validator preventing a "" value

Types

type PromptValidator

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

Jump to

Keyboard shortcuts

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