From 97f2ce35dfe91d1086d375b639879ab7314e1c4d Mon Sep 17 00:00:00 2001 From: Jules Casteran Date: Thu, 8 Jun 2023 16:22:16 +0200 Subject: [PATCH] fix(shell): crash on help flag --- internal/core/shell.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/core/shell.go b/internal/core/shell.go index ac36c23e9d..82e78135f1 100644 --- a/internal/core/shell.go +++ b/internal/core/shell.go @@ -271,6 +271,12 @@ func shellExecutor(rootCmd *cobra.Command, printer *Printer, meta *meta) func(s return } + // command is nil if it does not have a Run function + // ex: instance -h + if meta.command == nil { + return + } + autoCompleteCache.Update(meta.command.Namespace) printErr := printer.Print(meta.result, meta.command.getHumanMarshalerOpt())