Skip to content

Commit

Permalink
For flags that have both long and short versions, when checking if th…
Browse files Browse the repository at this point in the history
…e flag is set, check only a single flag, and not the full combined string
  • Loading branch information
danrabinowitz authored and aybabtme committed Oct 12, 2023
1 parent 9612436 commit 95ea346
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/humanlog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/signal"
"runtime"
"strconv"
"strings"

"github.com/aybabtme/rgbterm"
"github.com/blang/semver"
Expand Down Expand Up @@ -277,20 +278,20 @@ func newApp() *cli.App {
if c.IsSet(keepFlag.Name) {
cfg.Keep = ptr([]string(keep))
}
if c.IsSet(messageFieldsFlag.Name) {
if c.IsSet(strings.Split(messageFieldsFlag.Name, ",")[0]) {
cfg.MessageFields = ptr([]string(messageFields))
}

if c.IsSet(timeFieldsFlag.Name) {
if c.IsSet(strings.Split(timeFieldsFlag.Name, ",")[0]) {
cfg.TimeFields = ptr([]string(timeFields))
}

if c.IsSet(levelFieldsFlag.Name) {
if c.IsSet(strings.Split(levelFieldsFlag.Name, ",")[0]) {
cfg.LevelFields = ptr([]string(levelFields))
}

if c.IsSet(ignoreInterrupts.Name) {
cfg.Interrupt = ptr(c.Bool(ignoreInterrupts.Name))
if c.IsSet(strings.Split(ignoreInterrupts.Name, ",")[0]) {
cfg.Interrupt = ptr(c.Bool(strings.Split(ignoreInterrupts.Name, ",")[0]))
}

// apply the config
Expand Down

0 comments on commit 95ea346

Please sign in to comment.