cli

package
v0.4.13 Latest Latest
Warning

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

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

Documentation

Overview

Package for CLI operations.

Index

Constants

View Source
const (
	//lint:ignore U1000 ansi color code, keep it for future use
	ANSIRed   = "\033[1;31m"
	ANSIGreen = "\033[1;32m"
	ANSICyan  = "\033[1;36m"
	ANSIGray  = "\033[1;90m"
	ANSIReset = "\033[0m"

	ANSIBlinkRed   = "\033[1;5;31m"
	ANSIBlinkGreen = "\033[1;5;32m"
	ANSIBlinkCyan  = "\033[1;5;36m"
)

https://stackoverflow.com/questions/8357203/is-it-possible-to-display-text-in-a-console-with-a-strike-through-effect https://en.wikipedia.org/wiki/ANSI_escape_code

Variables

This section is empty.

Functions

func DebugPrintlnf

func DebugPrintlnf(debug bool, pat string, args ...any)

func ErrorPrintlnf

func ErrorPrintlnf(pat string, args ...any)

func LogWithCaller added in v0.3.5

func LogWithCaller(cond ...func(level string) bool) func(*cliLogger)

func LogWithDebug added in v0.3.5

func LogWithDebug(debug *bool) func(*cliLogger)

func LogWithTime added in v0.3.5

func LogWithTime(cond ...func(level string) bool) func(*cliLogger)

func NamedPrintlnf added in v0.3.2

func NamedPrintlnf(pat string, p map[string]any)

func NewLog added in v0.3.5

func NewLog(op ...func(l *cliLogger)) *cliLogger

func PkgVersion added in v0.4.0

func PkgVersion(location string, pkg string) (string, error)

Get dependency package version in current working directory.

func Printf added in v0.3.4

func Printf(pat string, args ...any)

func Printlnf

func Printlnf(pat string, args ...any)

func Run

func Run(executable string, args []string, opts ...func(*exec.Cmd)) (out []byte, err error)

Runs command.

If err is not nil, out may still contain output from the command.

rail can be nil.

func RunPy

func RunPy(pyExec string, pyContent string, args []string, opts ...func(*exec.Cmd)) (out []byte, err error)

Run python script.

Python executable must be available beforehand.

rail can be nil.

func TPrintlnf

func TPrintlnf(pat string, args ...any)

func TermOpenUrl

func TermOpenUrl(url string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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