From c3dbe93564ec4fbe13f74555a953a82ce3e94c1c Mon Sep 17 00:00:00 2001 From: Wes Date: Tue, 7 Jan 2025 14:19:55 -0700 Subject: [PATCH] fix: debug messages in 'ftl new' command output --- backend/provisioner/registry.go | 2 +- frontend/cli/cmd_new.go | 2 ++ frontend/cli/main.go | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/backend/provisioner/registry.go b/backend/provisioner/registry.go index b9b46ca5b..3fcb0efb9 100644 --- a/backend/provisioner/registry.go +++ b/backend/provisioner/registry.go @@ -92,7 +92,7 @@ func provisionerIDToProvisioner(ctx context.Context, id string, controller ftlv1 default: plugin, _, err := plugin.Spawn( ctx, - log.Debug, + log.FromContext(ctx).GetLevel(), "ftl-provisioner-"+id, ".", "ftl-provisioner-"+id, diff --git a/frontend/cli/cmd_new.go b/frontend/cli/cmd_new.go index 616c41c84..e80eec4b1 100644 --- a/frontend/cli/cmd_new.go +++ b/frontend/cli/cmd_new.go @@ -76,6 +76,8 @@ func (i newCmd) Run(ctx context.Context, ktctx *kong.Context, config projectconf } } _ = plugin.Kill() //nolint:errcheck + + fmt.Printf("Successfully created %s module %q in %s\n", i.Language, name, path) return nil } diff --git a/frontend/cli/main.go b/frontend/cli/main.go index 1a0757a76..6eb65f7cd 100644 --- a/frontend/cli/main.go +++ b/frontend/cli/main.go @@ -95,14 +95,6 @@ func main() { app := createKongApplication(&cli, csm) - // Dynamically update the kong app with language specific flags for the "ftl new" command. - languagePlugin, err := languageplugin.PrepareNewCmd(log.ContextWithNewDefaultLogger(ctx), app, os.Args[1:]) - app.FatalIfErrorf(err) - addToExit(app, func(code int) { - // Kill the plugin when the app exits due to an error, or after showing help. - languagePlugin.Close() - }) - kctx, err := app.Parse(os.Args[1:]) app.FatalIfErrorf(err) @@ -119,9 +111,6 @@ func main() { defer trace.Stop() } - // Plugins take time to launch, so we bind the "ftl new" plugin to the kong context. - kctx.Bind(languagePlugin) - if !cli.Plain { sm := terminal.NewStatusManager(ctx) csm.statusManager = optional.Some(sm) @@ -147,6 +136,17 @@ func main() { logger := log.Configure(os.Stderr, cli.LogConfig) ctx = log.ContextWithLogger(ctx, logger) + // Dynamically update the kong app with language specific flags for the "ftl new" command. + languagePlugin, err := languageplugin.PrepareNewCmd(log.ContextWithLogger(ctx, logger), app, os.Args[1:]) + app.FatalIfErrorf(err) + addToExit(app, func(code int) { + // Kill the plugin when the app exits due to an error, or after showing help. + languagePlugin.Close() + }) + + // Plugins take time to launch, so we bind the "ftl new" plugin to the kong context. + kctx.Bind(languagePlugin) + if cli.Insecure { logger.Warnf("--insecure skips TLS certificate verification") }