From 189155ea516173b6b156aa205f4311618a6737c8 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Wed, 23 Aug 2023 10:31:55 -0400 Subject: [PATCH] chore: update help template to run full initializers (#22) Signed-off-by: Keith Zantow --- help_template.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/help_template.go b/help_template.go index b45127c..c1cf3d4 100644 --- a/help_template.go +++ b/help_template.go @@ -56,7 +56,7 @@ func showConfigInRootHelp(a *application) { // note: since all commands tend to share help functions it's important to only patch the example // when there is no parent command (i.e. the root command). if cmd == a.root { - cfgs := append([]any{&appInitializer{a: a}, &a.state.Config}, a.state.Config.FromCommands...) + cfgs := append([]any{&a.state.Config, a}, a.state.Config.FromCommands...) for _, cfg := range cfgs { // load each config individually, as there may be conflicting names / types that will cause // viper to fail to read them all and panic @@ -74,13 +74,3 @@ func showConfigInRootHelp(a *application) { helpFn(cmd, args) }) } - -type appInitializer struct { - a *application -} - -var _ fangs.PostLoader = (*appInitializer)(nil) - -func (a *appInitializer) PostLoad() error { - return a.a.runInitializers() -}