add example hidden option #5

Merged
andrey merged 1 commits from example into master 2 years ago
  1. 3
      example/cmd/config/main.go
  2. 2
      example/pkg/command/args.go

3
example/cmd/config/main.go

@ -16,7 +16,8 @@ const (
AppName = "console" AppName = "console"
) )
// FDEVS_CONSOLE_CAT=env go run cmd/config/main.go fdevs:console:arg -b tmp. // FDEVS_CONSOLE_CAT=env FDEVS_CONSOLE_HIDDEN=2022-09-18T23:07:49+03:00 go run cmd/config/main.go fdevs:console:arg -b tmp.
// FDEVS_CONSOLE_CAT=env go run cmd/config/main.go fdevs:console:arg --hidden=2022-09-18T23:07:49+03:00 -b tmp.
func main() { func main() {
env := config.New(Namespace, AppName, []config.Provider{ env := config.New(Namespace, AppName, []config.Provider{
env.New(), env.New(),

2
example/pkg/command/args.go

@ -20,6 +20,7 @@ func Args() *console.Command {
option.String("bar", "required bar option", option.Required, option.Short('b')), option.String("bar", "required bar option", option.Required, option.Short('b')),
option.String("cat", "cat option", option.Short('c')), option.String("cat", "cat option", option.Short('c')),
option.Time("time", "time example"), option.Time("time", "time example"),
option.Time("hidden", "hidden time example", option.Hidden),
) )
return nil return nil
@ -29,6 +30,7 @@ func Args() *console.Command {
out.Println(ctx, "bar: <info>", in.Option(ctx, "bar").String(), "</info>") out.Println(ctx, "bar: <info>", in.Option(ctx, "bar").String(), "</info>")
out.Println(ctx, "cat: <info>", in.Option(ctx, "cat").String(), "</info>") out.Println(ctx, "cat: <info>", in.Option(ctx, "cat").String(), "</info>")
out.Println(ctx, "time: <info>", in.Option(ctx, "time").Time().Format(time.RFC3339), "</info>") out.Println(ctx, "time: <info>", in.Option(ctx, "time").Time().Format(time.RFC3339), "</info>")
out.Println(ctx, "hidden: <info>", in.Option(ctx, "hidden").Time().Format(time.RFC3339), "</info>")
return nil return nil
}, },

Loading…
Cancel
Save