From 73498a08de7789db7d52437972de16aca2ec70ff Mon Sep 17 00:00:00 2001 From: David Allen Date: Sat, 30 Aug 2025 00:13:05 -0600 Subject: [PATCH] fix: issue with host not being set for plugins cmd --- cmd/plugins.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/plugins.go b/cmd/plugins.go index 0308125..812b5a8 100644 --- a/cmd/plugins.go +++ b/cmd/plugins.go @@ -18,6 +18,9 @@ import ( var pluginsCmd = &cobra.Command{ Use: "plugins", Short: "Manage, inspect, and compile plugins (requires Go build tools)", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + setenv(cmd, "host", "MAKESHIFT_HOST") + }, } var pluginsCompileCmd = &cobra.Command{ @@ -89,7 +92,7 @@ var pluginsCompileCmd = &cobra.Command{ }, } -var pluginInspectCmd = &cobra.Command{ +var pluginsInspectCmd = &cobra.Command{ Use: "inspect", Args: cobra.MinimumNArgs(1), Example: ` @@ -120,7 +123,7 @@ var pluginInspectCmd = &cobra.Command{ }, } -var pluginInfoCmd = &cobra.Command{ +var pluginsInfoCmd = &cobra.Command{ Use: "info", Short: "Show plugin information", Args: cobra.MinimumNArgs(1), @@ -159,6 +162,7 @@ var pluginInfoCmd = &cobra.Command{ Any("status", map[string]any{ "code": res.StatusCode, "message": res.Status, + "body": string(body), }). Str("host", host). Msg("response returned bad status") @@ -174,8 +178,10 @@ var pluginInfoCmd = &cobra.Command{ } func init() { - pluginsCompileCmd.Flags().StringP("output", "o", "", "Set the path to save compiled plugin") - pluginsCmd.AddCommand(pluginsCompileCmd, pluginInspectCmd, pluginInfoCmd) + pluginsCompileCmd.PersistentFlags().StringP("output", "o", "", "Set the path to save compiled plugin") + pluginsInfoCmd.PersistentFlags().String("host", "http://localhost:5050", "Set the makeshift remote host (can be set with MAKESHIFT_HOST)") + + pluginsCmd.AddCommand(pluginsCompileCmd, pluginsInspectCmd, pluginsInfoCmd) rootCmd.AddCommand(pluginsCmd) }