Documentation
¶
Index ¶
- Constants
- Variables
- func AnsiCursorLineUp(lines int) string
- func AnsiCursorToColumn(offset int) string
- func BoolToYesNo(value bool) string
- func CleanId(text string) string
- func CommandBoolSetAndValue(cmd *cli.Command, name string) (bool, bool)
- func CreateTempFile(name string) (*os.File, error)
- func EncloseWhen(text string, when string, start string, end string) string
- func ExecUnameM() (string, error)
- func FileExists(name string) (bool, error)
- func FindFileInDir(dir string, names []string) (bool, string)
- func GetSystemArch() string
- func HumanizeSeconds(n int64) string
- func LogDebug(msg string)
- func LogError(err any)
- func LogInfo(msg string)
- func LogLn()
- func LogWarning(msg string)
- func PromptTextInput(reader *bufio.Reader, question string, defaultValue string) (string, error)
- func PromptYesNoInput(reader *bufio.Reader, question string) (bool, error)
- func QuotedWhenSpace(text string) string
- func ReadJsonFile[T any](name string) (*T, error)
- func ReaderReadLine(reader *bufio.Reader) (string, error)
- func ReplaceIllegalChars(text string) string
- func ResolvePath(name string) (string, error)
- func SliceContains[T comparable](slice []T, value T) bool
- func StartDetachedProcess(options *StartDetachedProcessOptions) error
- func StripAnsi(text string) string
- func TerminalErasePreviousLine()
- func TerminalLoadingSymbol(v int) string
- func TimeNowSeconds() int64
- func WriteFileAtomic(name string, bytes []byte) error
- func WriteJsonFile[T any](name string, data *T) error
- func WriteJsonFileAtomic[T any](name string, data *T) error
- type LogTable
- type StartDetachedProcessOptions
Constants ¶
View Source
const AnsiEsc = "\x1B"
View Source
const AnsiResetCursor = "\r"
Variables ¶
View Source
var AnsiEraseLine = fmt.Sprintf("%s[K", AnsiEsc)
View Source
var ArchMap = map[string][]string{
"amd64": {"amd64", "x86_64", "x86-64"},
"386": {"i386", "i686"},
"arm64": {"armhf", "aarch64"},
"arm": {"arm"},
}
View Source
var AtomicFilePrefix = "pho"
View Source
var LogDebugEnabled = os.Getenv("DEBUG") == "1"
View Source
var LogDebugPrefix = color.HiBlackString("debug:")
View Source
var LogErrorPrefix = color.RedString("error:")
View Source
var LogExclamationPrefix = color.RedString("!")
View Source
var LogQuestionPrefix = color.GreenString("?")
View Source
var LogRightArrowPrefix = color.MagentaString(">")
View Source
var LogTickPrefix = color.GreenString("√")
View Source
var LogWarnPrefix = color.YellowString("warning")
Functions ¶
func AnsiCursorLineUp ¶
func AnsiCursorToColumn ¶
func BoolToYesNo ¶ added in v0.1.10
func CommandBoolSetAndValue ¶ added in v0.1.7
func EncloseWhen ¶ added in v0.1.0
func ExecUnameM ¶
func FileExists ¶
func GetSystemArch ¶
func GetSystemArch() string
func HumanizeSeconds ¶
func LogWarning ¶
func LogWarning(msg string)
func PromptTextInput ¶
func QuotedWhenSpace ¶ added in v0.1.0
func ReadJsonFile ¶
func ReplaceIllegalChars ¶
func ResolvePath ¶
func SliceContains ¶ added in v0.1.3
func SliceContains[T comparable](slice []T, value T) bool
func StartDetachedProcess ¶ added in v0.1.3
func StartDetachedProcess(options *StartDetachedProcessOptions) error
func TerminalErasePreviousLine ¶
func TerminalErasePreviousLine()
func TimeNowSeconds ¶
func TimeNowSeconds() int64
func WriteFileAtomic ¶
func WriteJsonFile ¶
func WriteJsonFileAtomic ¶
Types ¶
type LogTable ¶
type LogTable struct {
Columns [][]string
RowsCount int
ColumnsCount int
RowWidths []int
RowSeparator string
ColumnSeparator string
}
func NewLogTable ¶
func NewLogTable() *LogTable
type StartDetachedProcessOptions ¶ added in v0.1.3
Click to show internal directories.
Click to hide internal directories.