From fc5c8720ac4fbacff7da13b8ea511e6ade62133e Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Mon, 18 Sep 2023 13:00:23 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20show=20scan+run+shell=20as=20reg?= =?UTF-8?q?ular=20commands=20in=20--help=20(#1777)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: ![image](https://github.com/mondoohq/cnquery/assets/1307529/71f2264f-cea6-40c6-bf7b-99de5e9c49ea) After: ![image](https://github.com/mondoohq/cnquery/assets/1307529/1a609580-dc2b-47f4-8c68-71498d76fb2e) Signed-off-by: Dominik Richter --- apps/cnquery/cmd/run.go | 2 ++ apps/cnquery/cmd/scan.go | 2 ++ apps/cnquery/cmd/shell.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/apps/cnquery/cmd/run.go b/apps/cnquery/cmd/run.go index 9bc81faf31..1402ede635 100644 --- a/apps/cnquery/cmd/run.go +++ b/apps/cnquery/cmd/run.go @@ -33,6 +33,8 @@ var RunCmd = &cobra.Command{ PreRun: func(cmd *cobra.Command, args []string) { viper.BindPFlag("platform-id", cmd.Flags().Lookup("platform-id")) }, + // we have to initialize an empty run so it shows up as a runnable command in --help + Run: func(cmd *cobra.Command, args []string) {}, } var RunCmdRun = func(cmd *cobra.Command, runtime *providers.Runtime, cliRes *plugin.ParseCLIRes) { diff --git a/apps/cnquery/cmd/scan.go b/apps/cnquery/cmd/scan.go index b7a68ce135..3199a5270d 100644 --- a/apps/cnquery/cmd/scan.go +++ b/apps/cnquery/cmd/scan.go @@ -103,6 +103,8 @@ To manually configure a query pack, use this: } return []string{}, cobra.ShellCompDirectiveNoFileComp }, + // we have to initialize an empty run so it shows up as a runnable command in --help + Run: func(cmd *cobra.Command, args []string) {}, } var scanCmdRun = func(cmd *cobra.Command, runtime *providers.Runtime, cliRes *plugin.ParseCLIRes) { diff --git a/apps/cnquery/cmd/shell.go b/apps/cnquery/cmd/shell.go index b983175b73..4f50060713 100644 --- a/apps/cnquery/cmd/shell.go +++ b/apps/cnquery/cmd/shell.go @@ -36,6 +36,8 @@ var shellCmd = &cobra.Command{ PreRun: func(cmd *cobra.Command, args []string) { viper.BindPFlag("platform-id", cmd.Flags().Lookup("platform-id")) }, + // we have to initialize an empty run so it shows up as a runnable command in --help + Run: func(cmd *cobra.Command, args []string) {}, } var shellRun = func(cmd *cobra.Command, runtime *providers.Runtime, cliRes *plugin.ParseCLIRes) {