nolint:dupl // false positive
(t *testing.T)
| 501 | |
| 502 | //nolint:dupl // false positive |
| 503 | func TestMultipleEnvarAutoHelpWithEnvPrefix(t *testing.T) { |
| 504 | type Anonymous struct { |
| 505 | Flag string `env:"FLAG1,FLAG2" help:"A flag."` |
| 506 | Other string `help:"A different flag."` |
| 507 | } |
| 508 | var cli struct { |
| 509 | Anonymous `envprefix:"ANON_"` |
| 510 | } |
| 511 | w := &strings.Builder{} |
| 512 | p := mustNew(t, &cli, kong.Writers(w, w), kong.Exit(func(int) {})) |
| 513 | _, err := p.Parse([]string{"--help"}) |
| 514 | assert.NoError(t, err) |
| 515 | assert.Contains(t, w.String(), "A flag ($ANON_FLAG1, $ANON_FLAG2).") |
| 516 | assert.Contains(t, w.String(), "A different flag.") |
| 517 | } |
| 518 | |
| 519 | //nolint:dupl // false positive |
| 520 | func TestCustomValueFormatter(t *testing.T) { |