From 4efeb71e28be1017acc600dc1e716d13121f4b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Fri, 9 Jul 2021 22:59:54 +0200 Subject: [PATCH] Set cobra.Command.CompletionOption already in createApp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... because our unit tests use createApp, so the current main()-only edit is not visible to unit tests. Signed-off-by: Miloslav Trmač --- cmd/skopeo/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/skopeo/main.go b/cmd/skopeo/main.go index f2a61bc4..89c4f9f0 100644 --- a/cmd/skopeo/main.go +++ b/cmd/skopeo/main.go @@ -45,6 +45,11 @@ func createApp() (*cobra.Command, *globalOptions) { }, SilenceUsage: true, SilenceErrors: true, + // Currently, skopeo uses manually written completions. Cobra allows + // for auto-generating completions for various shells. Podman is + // already making us of that. If Skopeo decides to follow, please + // remove the line below (and hide the `completion` command). + CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true}, } if gitCommit != "" { rootCommand.Version = fmt.Sprintf("%s commit: %s", version.Version, gitCommit) @@ -102,11 +107,6 @@ func main() { return } rootCmd, _ := createApp() - // Currently, skopeo uses manually written completions. Cobra allows - // for auto-generating completions for various shells. Podman is - // already making us of that. If Skopeo decides to follow, please - // remove the line below (and hide the `completion` command). - rootCmd.CompletionOptions.DisableDefaultCmd = true if err := rootCmd.Execute(); err != nil { logrus.Fatal(err) }