Skip to content

Commit

Permalink
Merge pull request #407 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 12.89.0
  • Loading branch information
andyone authored Nov 24, 2023
2 parents e0b1379 + fd1ae8b commit 82e968a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

### 12.89.0

* `[usage]` Added color customization for example description
* `[usage]` Changed default color for example description

### 12.88.1

* `[pager]` Improved pager search
Expand Down
2 changes: 1 addition & 1 deletion ek.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// ////////////////////////////////////////////////////////////////////////////////// //

// VERSION is current ek package version
const VERSION = "12.88.1"
const VERSION = "12.89.0"

// ////////////////////////////////////////////////////////////////////////////////// //

Expand Down
26 changes: 15 additions & 11 deletions usage/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ const _BREADCRUMBS_MIN_SIZE = 8
// ////////////////////////////////////////////////////////////////////////////////// //

const (
DEFAULT_COMMANDS_COLOR_TAG = "{y}"
DEFAULT_OPTIONS_COLOR_TAG = "{g}"
DEFAULT_APP_NAME_COLOR_TAG = "{c*}"
DEFAULT_APP_VER_COLOR_TAG = "{c}"
DEFAULT_APP_REL_COLOR_TAG = "{s}"
DEFAULT_APP_BUILD_COLOR_TAG = "{s-}"
DEFAULT_COMMANDS_COLOR_TAG = "{y}"
DEFAULT_OPTIONS_COLOR_TAG = "{g}"
DEFAULT_EXAMPLE_DESC_COLOR_TAG = "{&}{s-}"
DEFAULT_APP_NAME_COLOR_TAG = "{c*}"
DEFAULT_APP_VER_COLOR_TAG = "{c}"
DEFAULT_APP_REL_COLOR_TAG = "{s}"
DEFAULT_APP_BUILD_COLOR_TAG = "{s-}"
)

const (
Expand Down Expand Up @@ -89,10 +90,12 @@ type About struct {

// Info contains info about commands, options, and examples
type Info struct {
AppNameColorTag string // AppNameColorTag contains default app name color tag
CommandsColorTag string // CommandsColorTag contains default commands color tag
OptionsColorTag string // OptionsColorTag contains default options color tag
Breadcrumbs bool // Breadcrumbs is flag for using bread crumbs for commands and options output
AppNameColorTag string // AppNameColorTag contains default app name color tag
CommandsColorTag string // CommandsColorTag contains default commands color tag
OptionsColorTag string // OptionsColorTag contains default options color tag
ExampleDescColorTag string // ExampleDescColorTag contains default example description color tag

Breadcrumbs bool // Breadcrumbs is flag for using bread crumbs for commands and options output

Name string // Name is app name
Args []string // Args is slice with app arguments
Expand Down Expand Up @@ -482,7 +485,8 @@ func (e *Example) Print() {
}

if e.Desc != "" {
fmtc.Printf(" {s-}%s{!}\n", e.Desc)
descColor := strutil.Q(strutil.B(fmtc.IsTag(e.info.ExampleDescColorTag), e.info.ExampleDescColorTag, DEFAULT_EXAMPLE_DESC_COLOR_TAG), DEFAULT_EXAMPLE_DESC_COLOR_TAG)
fmtc.Printf(" "+descColor+"%s{!}\n", e.Desc)
}
}

Expand Down
4 changes: 3 additions & 1 deletion usage/usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (s *UsageSuite) TestRawVersion(c *C) {
func (s *UsageSuite) TestUsage(c *C) {
info := NewInfo("", "file")

info.AddSpoiler("This is usage of spoiler with {g}c{c}o{r}l{m}o{b}r{g}s{!} support")
info.AddSpoiler("This is usage of spoiler with {#240}c{#241}o{#242}l{#243}o{#244}r{#245}s {#246}s{#247}u{#248}p{#249}p{#250}o{#251}r{#252}t{!}")

info.AddCommand() // will be ignored
info.AddCommand("print", "Print command")
Expand Down Expand Up @@ -132,8 +132,10 @@ func (s *UsageSuite) TestUsage(c *C) {
info.Render()

info.Breadcrumbs = false
info.AppNameColorTag = "{#202}"
info.CommandsColorTag = "{m}"
info.OptionsColorTag = "{b}"
info.ExampleDescColorTag = "{&}{b}"

info.Render()

Expand Down

0 comments on commit 82e968a

Please sign in to comment.