package cmd import ( "axolotl/output" "axolotl/service" "fmt" "os" "github.com/spf13/cobra" ) var showCmd = &cobra.Command{ Use: "show ", Short: "Show node details", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { svc, err := service.GetNodeService(cfg) if err != nil { fmt.Fprintln(os.Stderr, err) return } n, err := svc.GetByID(args[0]) if err != nil { fmt.Fprintln(os.Stderr, "node not found:", args[0]) os.Exit(1) } output.PrintNode(cmd.OutOrStdout(), svc, n, jsonFlag) }, } func init() { rootCmd.AddCommand(showCmd) }