cmd

package
v0.12.0-nightly2021041301 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 7 Imported by: 5

Documentation

Overview

Package cmd contains utilities for command line tools.

Index

Constants

View Source
const (
	DelimiterLine = "--------------------------------------------------------------------------------"
)

Variables

View Source
var PerformingShellCompletion bool

PerformingShellCompletion indicates whether or not one of Cobra's hidden shell completion commands is being used.

View Source
var TerminationSignals = []os.Signal{
	syscall.SIGINT,
	syscall.SIGTERM,
}

TerminationSignals are those signals which Mutagen considers to be requesting termination. Certain other signals that also request termination (such as SIGABRT) are intentionally ignored because they're handled by the Go runtime and have special behavior (such as dumping a stack trace). Both SIGINT and SIGTERM are emulated on Windows (SIGINT on Ctrl-C and Ctrl-Break and SIGTERM on CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT).

Functions

func DisallowArguments added in v0.13.0

func DisallowArguments(_ *cobra.Command, arguments []string) error

DisallowArguments is a Cobra arguments validator that disallows positional arguments. It is an alternative to cobra.NoArgs, which treats arguments as command names and returns a somewhat cryptic error message.

func Error

func Error(err error)

Error prints an error message to standard error.

func Fatal

func Fatal(err error)

Fatal prints an error message to standard error and then terminates the process with an error exit code.

func HandleTerminalCompatibility added in v0.6.0

func HandleTerminalCompatibility()

HandleTerminalCompatibility automatically restarts the current process inside a terminal compatibility emulator if necessary. It currently only handles the case of mintty consoles on Windows requiring a relaunch of the current command inside winpty.

func Warning

func Warning(message string)

Warning prints a warning message to standard error.

Types

type StatusLinePrinter added in v0.6.0

type StatusLinePrinter struct {
	// UseStandardError causes the printer to use standard error for its output
	// instead of standard output (the default).
	UseStandardError bool
	// contains filtered or unexported fields
}

StatusLinePrinter provides printing facilities for dynamically updating status lines in the console. It supports colorized printing.

func (*StatusLinePrinter) BreakIfNonEmpty added in v0.6.0

func (p *StatusLinePrinter) BreakIfNonEmpty()

BreakIfNonEmpty prints a newline character if the current line is non-empty.

func (*StatusLinePrinter) Clear added in v0.6.0

func (p *StatusLinePrinter) Clear()

Clear clears any content on the status line and moves the cursor back to the beginning of the line.

func (*StatusLinePrinter) Print added in v0.6.0

func (p *StatusLinePrinter) Print(message string)

Print prints a message to the status line, overwriting any existing content. Color escape sequences are supported. Messages will be truncated to a platform-dependent maximum length and padded appropriately.

type StatusLinePrompter added in v0.13.0

type StatusLinePrompter struct {
	// Printer is the underlying printer.
	Printer *StatusLinePrinter
}

StatusLinePrompter adapts a StatusLinePrinter to act as a Mutagen prompter. The printer will be used to perform messaging and PromptCommandLine will be used to perform prompting.

func (*StatusLinePrompter) Message added in v0.13.0

func (p *StatusLinePrompter) Message(message string) error

Message implements prompting.Prompter.Message.

func (*StatusLinePrompter) Prompt added in v0.13.0

func (p *StatusLinePrompter) Prompt(message string) (string, error)

Prompt implements prompting.Prompter.Prompt.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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