pax_global_header 0000666 0000000 0000000 00000000064 14223777120 0014517 g ustar 00root root 0000000 0000000 52 comment=639f5712655d523d73724245926c9e98ee4ff635
coloredcobra-1.0.1/ 0000775 0000000 0000000 00000000000 14223777120 0014154 5 ustar 00root root 0000000 0000000 coloredcobra-1.0.1/.gitignore 0000664 0000000 0000000 00000000433 14223777120 0016144 0 ustar 00root root 0000000 0000000 # Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.bak
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
.vscode/ coloredcobra-1.0.1/LICENSE 0000664 0000000 0000000 00000002053 14223777120 0015161 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2022 Ivan Pirog
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
coloredcobra-1.0.1/README.md 0000664 0000000 0000000 00000006767 14223777120 0015453 0 ustar 00root root 0000000 0000000 
---
**[Cobra](https://github.com/spf13/cobra)** library for creating powerful modern CLI doesn't support color settings for console output. `ColoredCobra` is a small library that allows you to colorize the text output of the Cobra library, making the console output look better.

`ColoredCobra` provides very simple set of settings that allows you to customize individual parts of Cobra text output by specifying a color for them, as well as bold, italic, underlined styles.

It's very easy to add `ColoredCobra` to your project!
---
## Installing
Open terminal and execute:
```bash
go get -u github.com/ivanpirog/coloredcobra
```
## Quick start
Open your `cmd/root.go` and insert this code:
```go
import cc "github.com/ivanpirog/coloredcobra"
```
Or:
```go
import (
...
cc "github.com/ivanpirog/coloredcobra"
)
```
Then put this code at the beginning of the `Execute()` function:
```go
cc.Init(&cc.Config{
RootCmd: rootCmd,
Headings: cc.HiCyan + cc.Bold + cc.Underline,
Commands: cc.HiYellow + cc.Bold,
Example: cc.Italic,
ExecName: cc.Bold,
Flags: cc.Bold,
})
```
That's all. Now build your project and see the output of the help command.
## Overview
`Config{}` has just one required parameter `RootCmd`. This is a pointer to the Cobra's root command. Rest of parameters have default values.
Style of any part of text output is represented by a sum of predefined constants. For example:
```go
Headings: cc.HiYellow + cc.Bold + cc.Underline
Commands: cc.Red + cc.Bold
ExecName: cc.Bold // equals cc.White + cc.Bold
Example: cc.Underline // equals cc.White + cc.Underline
```
### Available color constants:
```
Black
Red
Green
Yellow
Blue
Magenta
Cyan
White (default)
HiRed (Hi-Intensity Red)
HiGreen
HiYellow
HiBlue
HiMagenta
HiCyan
HiWhite
```
### Available text formatting constants:
```
Bold
Italic
Underline
```
### Available config parameters:

* `Headings:` headers style.
* `Commands:` commands style.
* `CmdShortDescr:` short description of commands style.
* `ExecName:` executable name style.
* `Flags:` short and long flag names (-f, --flag) style.
* `FlagsDataType:` style of flags data type.
* `FlagsDescr:` flags description text style.
* `Aliases:` list of command aliases style.
* `Example:` example text style.
* `NoExtraNewlines:` no line breaks before and after headings, if `true`. By default: `false`.
* `NoBottomNewline:` no line break at the end of Cobra's output, if `true`. By default: `false`.
### `NoExtraNewlines` parameter results:

## How it works
`ColoredCobra` patches Cobra's usage template and extends it with functions for text styling. [fatih/color](https://github.com/fatih/color) library is used for coloring text output in console.
## License
ColoredCobra is released under the MIT license. See [LICENSE](https://github.com/ivanpirog/coloredcobra/blob/main/LICENSE).
coloredcobra-1.0.1/coloredcobra.go 0000664 0000000 0000000 00000021077 14223777120 0017150 0 ustar 00root root 0000000 0000000 // ColoredCobra allows you to colorize Cobra's text output,
// making it look better using simple settings to customize
// individual parts of console output.
//
// Usage example:
//
// 1. Insert in cmd/root.go file of your project :
//
// import cc "github.com/ivanpirog/coloredcobra"
//
//
// 2. Put the following code to the beginning of the Execute() function:
//
// cc.Init(&cc.Config{
// RootCmd: rootCmd,
// Headings: cc.Bold + cc.Underline,
// Commands: cc.Yellow + cc.Bold,
// ExecName: cc.Bold,
// Flags: cc.Bold,
// })
//
//
// 3. Build & execute your code.
//
//
// Copyright © 2022 Ivan Pirog .
// Released under the MIT license.
// Project home: https://github.com/ivanpirog/coloredcobra
//
package coloredcobra
import (
"regexp"
"strings"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
// Config is a settings structure which sets styles for individual parts of Cobra text output.
//
// Note that RootCmd is required.
//
// Example:
//
// c := &cc.Config{
// RootCmd: rootCmd,
// Headings: cc.HiWhite + cc.Bold + cc.Underline,
// Commands: cc.Yellow + cc.Bold,
// CmdShortDescr: cc.Cyan,
// ExecName: cc.Bold,
// Flags: cc.Bold,
// Aliases: cc.Bold,
// Example: cc.Italic,
// }
type Config struct {
RootCmd *cobra.Command
Headings uint8
Commands uint8
CmdShortDescr uint8
ExecName uint8
Flags uint8
FlagsDataType uint8
FlagsDescr uint8
Aliases uint8
Example uint8
NoExtraNewlines bool
NoBottomNewline bool
}
// Constants for colors and B, I, U
const (
None = 0
Black = 1
Red = 2
Green = 3
Yellow = 4
Blue = 5
Magenta = 6
Cyan = 7
White = 8
HiRed = 9
HiGreen = 10
HiYellow = 11
HiBlue = 12
HiMagenta = 13
HiCyan = 14
HiWhite = 15
Bold = 16
Italic = 32
Underline = 64
)
// Init patches Cobra's usage template with configuration provided.
func Init(cfg *Config) {
if cfg.RootCmd == nil {
panic("coloredcobra: Root command pointer is missing.")
}
// Get usage template
tpl := cfg.RootCmd.UsageTemplate()
//
// Add extra line breaks for headings
//
if cfg.NoExtraNewlines == false {
tpl = strings.NewReplacer(
"Usage:", "\nUsage:\n",
"Aliases:", "\nAliases:\n",
"Examples:", "\nExamples:\n",
"Available Commands:", "\nAvailable Commands:\n",
"Global Flags:", "\nGlobal Flags:\n",
"Additional help topics:", "\nAdditional help topics:\n",
"Use \"", "\nUse \"",
).Replace(tpl)
re := regexp.MustCompile(`(?m)^Flags:$`)
tpl = re.ReplaceAllString(tpl, "\nFlags:\n")
}
//
// Styling headers
//
if cfg.Headings != None {
ch := getColor(cfg.Headings)
// Add template function to style the headers
cobra.AddTemplateFunc("HeadingStyle", ch.SprintFunc())
// Wrap template headers into a new function
tpl = strings.NewReplacer(
"Usage:", `{{HeadingStyle "Usage:"}}`,
"Aliases:", `{{HeadingStyle "Aliases:"}}`,
"Examples:", `{{HeadingStyle "Examples:"}}`,
"Available Commands:", `{{HeadingStyle "Available Commands:"}}`,
"Global Flags:", `{{HeadingStyle "Global Flags:"}}`,
"Additional help topics:", `{{HeadingStyle "Additional help topics:"}}`,
).Replace(tpl)
re := regexp.MustCompile(`(?m)^(\s*)Flags:(\s*)$`)
tpl = re.ReplaceAllString(tpl, `$1{{HeadingStyle "Flags:"}}$2`)
}
//
// Styling commands
//
if cfg.Commands != None {
cc := getColor(cfg.Commands)
// Add template function to style commands
cobra.AddTemplateFunc("CommandStyle", cc.SprintFunc())
cobra.AddTemplateFunc("sum", func(a, b int) int {
return a + b
})
// Patch usage template
re := regexp.MustCompile(`(?i){{\s*rpad\s+.Name\s+.NamePadding\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{rpad (CommandStyle .Name) (sum .NamePadding 12)}}")
re = regexp.MustCompile(`(?i){{\s*rpad\s+.CommandPath\s+.CommandPathPadding\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{rpad (CommandStyle .CommandPath) (sum .CommandPathPadding 12)}}")
}
//
// Styling a short desription of commands
//
if cfg.CmdShortDescr != None {
csd := getColor(cfg.CmdShortDescr)
cobra.AddTemplateFunc("CmdShortStyle", csd.SprintFunc())
re := regexp.MustCompile(`(?ism)({{\s*range\s+.Commands\s*}}.*?){{\s*.Short\s*}}`)
tpl = re.ReplaceAllString(tpl, `$1{{CmdShortStyle .Short}}`)
}
//
// Styling executable file name
//
if cfg.ExecName != None {
cen := getColor(cfg.ExecName)
// Add template functions
cobra.AddTemplateFunc("ExecStyle", cen.SprintFunc())
cobra.AddTemplateFunc("UseLineStyle", func(s string) string {
spl := strings.Split(s, " ")
spl[0] = cen.Sprint(spl[0])
return strings.Join(spl, " ")
})
// Patch usage template
re := regexp.MustCompile(`(?i){{\s*.CommandPath\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{ExecStyle .CommandPath}}")
re = regexp.MustCompile(`(?i){{\s*.UseLine\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{UseLineStyle .UseLine}}")
}
//
// Styling flags
//
var cf, cfd, cfdt *color.Color
if cfg.Flags != None {
cf = getColor(cfg.Flags)
}
if cfg.FlagsDescr != None {
cfd = getColor(cfg.FlagsDescr)
}
if cfg.FlagsDataType != None {
cfdt = getColor(cfg.FlagsDataType)
}
if cf != nil || cfd != nil || cfdt != nil {
cobra.AddTemplateFunc("FlagStyle", func(s string) string {
// Flags info section is multi-line.
// Let's split these lines and iterate them.
lines := strings.Split(s, "\n")
for k := range lines {
// Styling short and full flags (-f, --flag)
if cf != nil {
re := regexp.MustCompile(`(--?\S+)`)
for _, flag := range re.FindAllString(lines[k], 2) {
lines[k] = strings.Replace(lines[k], flag, cf.Sprint(flag), 1)
}
}
// If no styles for flag data types and description - continue
if cfd == nil && cfdt == nil {
continue
}
// Split line into two parts: flag data type and description
// Tip: Use debugger to understand the logic
re := regexp.MustCompile(`\s{2,}`)
spl := re.Split(lines[k], -1)
if len(spl) != 3 {
continue
}
// Styling the flag description
if cfd != nil {
lines[k] = strings.Replace(lines[k], spl[2], cfd.Sprint(spl[2]), 1)
}
// Styling flag data type
// Tip: Use debugger to understand the logic
if cfdt != nil {
re = regexp.MustCompile(`\s+(\w+)$`) // the last word after spaces is the flag data type
m := re.FindAllStringSubmatch(spl[1], -1)
if len(m) == 1 && len(m[0]) == 2 {
lines[k] = strings.Replace(lines[k], m[0][1], cfdt.Sprint(m[0][1]), 1)
}
}
}
s = strings.Join(lines, "\n")
return s
})
// Patch usage template
re := regexp.MustCompile(`(?i)(\.(InheritedFlags|LocalFlags)\.FlagUsages)`)
tpl = re.ReplaceAllString(tpl, "FlagStyle $1")
}
//
// Styling aliases
//
if cfg.Aliases != None {
ca := getColor(cfg.Aliases)
cobra.AddTemplateFunc("AliasStyle", ca.SprintFunc())
re := regexp.MustCompile(`(?i){{\s*.NameAndAliases\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{AliasStyle .NameAndAliases}}")
}
//
// Styling the example text
//
if cfg.Example != None {
ce := getColor(cfg.Example)
cobra.AddTemplateFunc("ExampleStyle", ce.SprintFunc())
re := regexp.MustCompile(`(?i){{\s*.Example\s*}}`)
tpl = re.ReplaceAllLiteralString(tpl, "{{ExampleStyle .Example}}")
}
// Adding a new line to the end
if !cfg.NoBottomNewline {
tpl += "\n"
}
// Apply patched template
cfg.RootCmd.SetUsageTemplate(tpl)
// Debug line, uncomment when needed
// fmt.Println(tpl)
}
// getColor decodes color param and returns color.Color object
func getColor(param uint8) (c *color.Color) {
switch param & 15 {
case None:
c = color.New(color.FgWhite)
case Black:
c = color.New(color.FgBlack)
case Red:
c = color.New(color.FgRed)
case Green:
c = color.New(color.FgGreen)
case Yellow:
c = color.New(color.FgYellow)
case Blue:
c = color.New(color.FgBlue)
case Magenta:
c = color.New(color.FgMagenta)
case Cyan:
c = color.New(color.FgCyan)
case White:
c = color.New(color.FgWhite)
case HiRed:
c = color.New(color.FgHiRed)
case HiGreen:
c = color.New(color.FgHiGreen)
case HiYellow:
c = color.New(color.FgHiYellow)
case HiBlue:
c = color.New(color.FgHiBlue)
case HiMagenta:
c = color.New(color.FgHiMagenta)
case HiCyan:
c = color.New(color.FgHiCyan)
case HiWhite:
c = color.New(color.FgHiWhite)
}
if param&Bold == Bold {
c.Add(color.Bold)
}
if param&Italic == Italic {
c.Add(color.Italic)
}
if param&Underline == Underline {
c.Add(color.Underline)
}
return
}
coloredcobra-1.0.1/coloredcobra_test.go 0000664 0000000 0000000 00000011536 14223777120 0020206 0 ustar 00root root 0000000 0000000 package coloredcobra
import (
"fmt"
"testing"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
var (
rootCmd = &cobra.Command{
Use: "test",
Short: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
Long: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
Example: "There is an example.",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Test")
},
}
cfg *Config
)
type colorTest struct {
colorInt uint8
colorColor *color.Color
}
var colorTests = []colorTest{
{White, color.New(color.FgWhite)},
{Black, color.New(color.FgBlack)},
{Red, color.New(color.FgRed)},
{Green, color.New(color.FgGreen)},
{Yellow, color.New(color.FgYellow)},
{Blue, color.New(color.FgBlue)},
{Magenta, color.New(color.FgMagenta)},
{Cyan, color.New(color.FgCyan)},
{HiRed, color.New(color.FgHiRed)},
{HiGreen, color.New(color.FgHiGreen)},
{HiYellow, color.New(color.FgHiYellow)},
{HiBlue, color.New(color.FgHiBlue)},
{HiMagenta, color.New(color.FgHiMagenta)},
{HiCyan, color.New(color.FgHiCyan)},
{HiWhite, color.New(color.FgHiWhite)},
{White + Bold + Italic + Underline, color.New(color.FgWhite, color.Bold, color.Italic, color.Underline)},
{Red + Bold, color.New(color.FgRed, color.Bold)},
{Yellow + Italic, color.New(color.FgYellow, color.Italic)},
{Blue + Underline, color.New(color.FgBlue, color.Underline)},
{Bold, color.New(color.FgWhite, color.Bold)},
{Italic, color.New(color.FgWhite, color.Italic)},
{Underline, color.New(color.FgWhite, color.Underline)},
}
func TestGetColor(t *testing.T) {
for _, test := range colorTests {
res1 := fmt.Sprintf("%v", getColor(test.colorInt))
res2 := fmt.Sprintf("%v", test.colorColor)
if res1 != res2 {
t.Errorf("got: %s, expected: %s", res1, res2)
}
}
}
type templateTest struct {
in, out string
}
var templateTestHeadings = []templateTest{
{`Usage:`, `{{HeadingStyle "Usage:"}}`},
{`Aliases:`, `{{HeadingStyle "Aliases:"}}`},
{`Examples:`, `{{HeadingStyle "Examples:"}}`},
{`Available Commands:`, `{{HeadingStyle "Available Commands:"}}`},
{`Global Flags:`, `{{HeadingStyle "Global Flags:"}}`},
{`Additional help topics:`, `{{HeadingStyle "Additional help topics:"}}`},
{`Flags:`, `{{HeadingStyle "Flags:"}}`},
}
var templateTests = []templateTest{
{`{{rpad .Name .NamePadding}}`, `{{rpad (CommandStyle .Name) (sum .NamePadding 12)}}`},
{`{{ rpad .Name .NamePadding }}`, `{{rpad (CommandStyle .Name) (sum .NamePadding 12)}}`},
{`{{rpad .CommandPath .CommandPathPadding}}`, `{{rpad (CommandStyle .CommandPath) (sum .CommandPathPadding 12)}}`},
{`{{ rpad .CommandPath .CommandPathPadding }}`, `{{rpad (CommandStyle .CommandPath) (sum .CommandPathPadding 12)}}`},
{`{{range .Commands}}{{.Short}}`, `{{range .Commands}}{{CmdShortStyle .Short}}`},
{`{{range .Commands}}{{ .Short }}`, `{{range .Commands}}{{CmdShortStyle .Short}}`},
{`{{.CommandPath}}`, `{{ExecStyle .CommandPath}}`},
{`{{ .CommandPath }}`, `{{ExecStyle .CommandPath}}`},
{`{{.UseLine}}`, `{{UseLineStyle .UseLine}}`},
{`{{ .useline }}`, `{{UseLineStyle .UseLine}}`},
{`{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}`, `{{FlagStyle .LocalFlags.FlagUsages | trimTrailingWhitespaces}}`},
{`{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}`, `{{FlagStyle .InheritedFlags.FlagUsages | trimTrailingWhitespaces}}`},
{`{{.NameAndAliases}}`, `{{AliasStyle .NameAndAliases}}`},
{`{{ .NameAndAliases }}`, `{{AliasStyle .NameAndAliases}}`},
{`{{.Example}}`, `{{ExampleStyle .Example}}`},
{`{{ .Example}}`, `{{ExampleStyle .Example}}`},
}
func TestTemplateReplaces(t *testing.T) {
cfg = &Config{
RootCmd: rootCmd,
Headings: HiCyan + Bold + Underline,
Commands: HiYellow + Bold,
CmdShortDescr: HiRed,
ExecName: Bold,
Flags: Bold,
FlagsDataType: Italic,
FlagsDescr: HiRed,
Aliases: HiMagenta + Underline,
Example: Italic,
NoExtraNewlines: true,
NoBottomNewline: true,
}
Init(cfg)
rootCmd.PersistentFlags().StringP("flag", "f", "", "Flag description")
rootCmd.UsageString()
// No extra new lines
for _, test := range templateTestHeadings {
makeTemplateTest(test, t)
}
for _, test := range templateTests {
makeTemplateTest(test, t)
}
// New line at the end of template
cfg.NoBottomNewline = false
for _, test := range templateTestHeadings {
test.out = test.out + "\n"
makeTemplateTest(test, t)
}
for _, test := range templateTests {
test.out = test.out + "\n"
makeTemplateTest(test, t)
}
// Extra new lines before and after headings
cfg.NoBottomNewline = true
cfg.NoExtraNewlines = false
for _, test := range templateTestHeadings {
test.out = "\n" + test.out + "\n"
makeTemplateTest(test, t)
}
}
func makeTemplateTest(test templateTest, t *testing.T) {
rootCmd.SetUsageTemplate(test.in)
Init(cfg)
res := rootCmd.UsageTemplate()
if res != test.out {
t.Errorf("got: %v, expected: %v", res, test.out)
}
}
coloredcobra-1.0.1/example/ 0000775 0000000 0000000 00000000000 14223777120 0015607 5 ustar 00root root 0000000 0000000 coloredcobra-1.0.1/example/cmd/ 0000775 0000000 0000000 00000000000 14223777120 0016352 5 ustar 00root root 0000000 0000000 coloredcobra-1.0.1/example/cmd/root.go 0000664 0000000 0000000 00000003141 14223777120 0017663 0 ustar 00root root 0000000 0000000 package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
cc "github.com/ivanpirog/coloredcobra"
)
var rootCmd = &cobra.Command{
Use: "example",
Short: "This is an example of using ColoreCobra library.",
Long: "This is just an example of using the ColoredCobra library. \n" +
"Project home: https://github.com/ivanpirog/coloredcobra",
Example: "There is a simple example of the Examples section.\n" +
"Just try commands:\n\n" +
"example help\n" +
"example help test",
Aliases: []string{"alias1", "alias2", "alias3"},
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("No commands given. Run 'example help' for usage help.\n" +
"Also try commands:\n\n" +
"example help\n" +
"example help test")
},
}
var (
// Used for flags.
flag1 string
flag2 string
abc []bool
)
func Execute() {
cc.Init(&cc.Config{
RootCmd: rootCmd,
Headings: cc.HiCyan + cc.Bold + cc.Underline,
Commands: cc.HiYellow + cc.Bold,
Aliases: cc.Bold + cc.Italic,
CmdShortDescr: cc.HiRed,
Example: cc.Italic,
ExecName: cc.Bold,
Flags: cc.Bold,
FlagsDescr: cc.HiRed,
FlagsDataType: cc.Italic,
})
rootCmd.PersistentFlags().StringVarP(&flag1, "flag", "f", "", "some flag")
rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution")
rootCmd.PersistentFlags().StringVarP(&flag2, "license", "l", "", "name of license for the project")
rootCmd.PersistentFlags().BoolSliceVar(&abc, "zzz", []bool{true, false}, "usage of bools")
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
coloredcobra-1.0.1/example/cmd/test.go 0000664 0000000 0000000 00000001055 14223777120 0017661 0 ustar 00root root 0000000 0000000 package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var (
Host string
Port int
)
var helloCmd = &cobra.Command{
Use: "test",
Short: "Test command for clarity",
Long: `This command prints a simple message "Hello world!"`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Hello, world!")
},
}
func init() {
helloCmd.Flags().StringVarP(&Host, "host", "s", "localhost", "A host for the Hello World server")
helloCmd.Flags().IntVarP(&Port, "port", "p", 8080, "A port for the Hello World server")
rootCmd.AddCommand(helloCmd)
}
coloredcobra-1.0.1/example/main.go 0000664 0000000 0000000 00000000145 14223777120 0017062 0 ustar 00root root 0000000 0000000 package main
import "github.com/ivanpirog/coloredcobra/example/cmd"
func main() {
cmd.Execute()
}
coloredcobra-1.0.1/go.mod 0000664 0000000 0000000 00000000176 14223777120 0015266 0 ustar 00root root 0000000 0000000 module github.com/ivanpirog/coloredcobra
go 1.15
require (
github.com/fatih/color v1.13.0
github.com/spf13/cobra v1.4.0
)
coloredcobra-1.0.1/go.sum 0000664 0000000 0000000 00000003602 14223777120 0015310 0 ustar 00root root 0000000 0000000 github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=