cui
cui copied to clipboard
UI elements for CLI apps
CUI (Commandline User Interface)
CUI gives us a set of useful tools while developing cli apps.
Features
- Alerts
- Pre-made Cobra commands
Requirements
Getting Started
go get github.com/erdaltsksn/cui
touch main.go
main.go:
package main
import (
"fmt"
"github.com/erdaltsksn/cui"
)
func main() {
cui.Info("Information message")
}
go run main.go
Example Output:
Installation
go get github.com/erdaltsksn/cui
Updating / Upgrading
go get -u github.com/erdaltsksn/cui
Usage
Alerts
// Success
cui.Success("This is a success message")
// Info
cui.Info("Information message")
// Warning
details := "This is the details"
cui.Warning("Warning message", details)
// Error
err := errors.New("Wrapped error message")
if err != nil {
cui.Error("Error message", err)
}
Version Command
.goreleaser.yml:
builds:
- main:
ldflags: -s -w -X github.com/erdaltsksn/cui.appVersion={{.Tag}}
cmd/root.go:
package cmd
import (
"github.com/spf13/cobra"
"github.com/erdaltsksn/cui"
)
func init() {
rootCmd.AddCommand(cui.VersionCmd)
}
Check out examples directory for more.
Contributing
If you want to contribute to this project and make it better, your help is very welcome.
For more information, see Contributing Guide.
Security Policy
If you discover a security vulnerability within this project, please follow our Security Policy.
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
Disclaimer
In no event shall we be liable to you or any third parties for any special, punitive, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including, without limitation, those resulting from loss of use, data or profits, and on any theory of liability, arising out of or in connection with the use of this software.