term

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorrectCommand

func CorrectCommand(message, command string, corrections ...string)

CorrectCommand writes the error message to STDERR explaining the command in the following format:

error: <message>

    <correct-command>

followed by os.Exit(1) call.

command should be a format string, containing `%s` for provided corrections.

func Error

func Error(messages ...string)

Error writes provided error messages to STDERR in the following format:

error: <message 1>
       <message 2>
       ...

followed by os.Exit(1) call.

func ResolveOutput

func ResolveOutput(output string, err error) (*os.File, error)

ResolveOutput is a helper function that accepts return of [*pflag.FlagSet.GetString](). If output is not specified (i.e. `err != nil`) or output is equal to dash (`-`), os.Stdout is returned. Otherwise ResolveOutput returns result of os.Create.

func Warn

func Warn(messages ...string)

Warn writes provided warning message to STDERR in the following format:

warning: <message 1>
         <message 2>
         ...

func YesNo

func YesNo(prompt string, defaultValue bool) (bool, error)

YesNo prompts user to enter Y (yes) or N (no) and returns boolean respectively. If input is invalid, error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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