out

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

© Ben Garrett https://github.com/bengarrett/dupers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnterKey

func EnterKey() byte

EnterKey returns the Enter keyboard code.

func ErrAppend

func ErrAppend(err error)

ErrAppend appends the error to the current line in stdout.

func ErrCont

func ErrCont(err error)

ErrCont prints the error.

func ErrFatal

func ErrFatal(err error)

ErrFatal prints the error and exits the program.

func Example

func Example(cmd string)

Example is intended for help screens and prints the example command.

func PBug

func PBug(debug string)

PBug prints the string to a newline.

func Prompt

func Prompt(question string) string

Prompt prints the question to stdout and prompts for a string reply. The prompt will loop until Enter key or Ctrl-C are pressed.

func RMLine

func RMLine() string

RMLine uses ANSI to erase the current line in stdout.

func Response

func Response(s string, quiet bool)

Response prints the string when quiet is false.

func Status

func Status(count, total int, m Mode) string

Status prints out the current file or item processing count.

func YN

func YN(question string, recommend YND) bool

YN prints the question to stdout and prompts for a yes or no reply. The prompt will loop unless a y or n value is given or Ctrl-C is pressed.

Types

type Mode

type Mode uint

Mode for the current processing count.

const (
	// Check returns Checking items.
	Check Mode = iota
	// Look returns Looking up items.
	Look
	// Scan returns Scanning files.
	Scan
	// Read returns Reading items.
	Read

	// ANSI control code to erase the current line in stdout.
	EraseLine = "\u001b[2K"

	MatchPrefix = "\n  ⤷\t"
)

type YND

type YND uint

YND is the YN default value to use when there is no input given.

const (
	// Nil does not set a default value.
	Nil YND = iota
	// Yes sets the default value.
	Yes
	// No sets the default value.
	No
)

Jump to

Keyboard shortcuts

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