fix: issue with host not being set for plugins cmd

This commit is contained in:
David Allen 2025-08-30 00:13:05 -06:00
parent 0f6f8957f6
commit 73498a08de
Signed by: towk
GPG key ID: 0430CDBE22619155

View file

@ -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)
}