modulepackage
0.0.0-20211121125910-b2c5cd7b6dc9
Repository: https://github.com/enr/clui.git
Documentation: pkg.go.dev
# README
Go Clui
Opinionated, minimalistic and cross platform Go library to manage output of command line apps.
Clui concepts:
- Layout: the output style, eg. plain or machine readable
- VerbosityLevel: how the output is filtered
- Interactivity: if wait for user's answers
Import the library:
import (
"github.com/enr/clui"
)
Creation of a default Clui
:
ui, err := clui.NewClui()
Creation with configuration:
verbosity := func(ui *clui.Clui) {
ui.VerbosityLevel = clui.VerbosityLevelHigh
}
ui, _ := clui.NewClui(verbosity)
See examples
directory for more.
License
A lot of code of this library was taken from Packer UI released under the same license (Mozilla Public License Version 2.0).
Mozilla Public License Version 2.0 - see LICENSE file.
Copyright 2015 clui contributors
# Packages
No description provided by the author
# Functions
DefaultClui is the factory function for a Clui with default configuration.
NewClui is the factory function allowing to configure the Clui.
# Constants
MessageCategoryConfidential confidential messages.
MessageCategoryError error.
MessageCategoryInfo info.
MessageCategoryQuestion question.
MessageCategoryWarn warning.
UIColorBlue blue.
UIColorCyan cyan.
UIColorGray gray.
UIColorGreen green.
UIColorMagenta magenta.
UIColorNone no color.
UIColorRed red.
UIColorYellow yellow.
VerbosityLevelHigh allows all messages.
VerbosityLevelLow allows warn and error.
VerbosityLevelMedium allows lifecycle, success, warn and error.
VerbosityLevelMute mutes all messages.
# Structs
Clui is the actual message writer.
MachineReadableLayout layout for programmatic access.
PlainLayout is the defaut and simplest Layout.
# Interfaces
Layout of the final message.
# Type aliases
MessageCategory classify the message.
UIColor represents color.
VerbosityLevel of messages.