cli

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cli provides utilities for happy command line interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCommandInvalid = errors.New("invalid command definition")
	ErrCommandArgs    = errors.New("command arguments error")
	ErrCommandFlags   = errors.New("command flags error")
	ErrPanic          = errors.New("there was panic, check logs for more info")
)

Functions

func AskForConfirmation

func AskForConfirmation(q string) bool

AskForConfirmation gets (y/Y)es or (n/N)o from cli input.

func AskForInput

func AskForInput(q string) string

func ExecCommand

func ExecCommand(sess *happy.Session, cmd *exec.Cmd) (string, error)

ExecCommand wraps ExecCommandRaw to return output as string.

func ExecCommandRaw

func ExecCommandRaw(sess *happy.Session, cmd *exec.Cmd) ([]byte, error)

ExecCommandRaw wraps and executes provided command and returns its CombinedOutput. It ensures that -x flag is taken into account and Command is Session Context aware.

func RunCommand

func RunCommand(sess *happy.Session, cmd *exec.Cmd) error

RunCommand wraps and executes provided command and writes its Stdout and Stderr. It ensures that -x flag is taken into account and Command is Session Context aware.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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