Skip to content

Commit

Permalink
Ensure parser configs are json-able
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Jul 2, 2023
1 parent e20e7ba commit da1ca8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func ExampleParserConfig_simple() {
"hello", "-a=from", "the", "ether", "sub", "marge", "patty", "selma", "-b",
}

if _, err := json.Marshal(pCfg.Prog); err != nil {
log.Fatal(err)
}

pt, err := argh.ParseArgs(os.Args, pCfg)
if err != nil {
argh.PrintParserError(os.Stderr, err)
Expand Down
4 changes: 2 additions & 2 deletions parser_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type CommandConfig struct {
Flags *Flags
Commands *Commands

On func(CommandFlag)
On func(CommandFlag) `json:"-"`
}

func (cCfg *CommandConfig) init() {
Expand Down Expand Up @@ -137,7 +137,7 @@ type FlagConfig struct {
Persist bool
ValueNames []string

On func(CommandFlag)
On func(CommandFlag) `json:"-"`
}

type Flags struct {
Expand Down

0 comments on commit da1ca8b

Please sign in to comment.