mirror of
https://github.com/containers/skopeo.git
synced 2025-09-09 02:29:49 +00:00
Set cobra.Command.CompletionOption already in createApp
... because our unit tests use createApp, so the current main()-only edit is not visible to unit tests. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@@ -45,6 +45,11 @@ func createApp() (*cobra.Command, *globalOptions) {
|
|||||||
},
|
},
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
SilenceErrors: 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 != "" {
|
if gitCommit != "" {
|
||||||
rootCommand.Version = fmt.Sprintf("%s commit: %s", version.Version, gitCommit)
|
rootCommand.Version = fmt.Sprintf("%s commit: %s", version.Version, gitCommit)
|
||||||
@@ -102,11 +107,6 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
rootCmd, _ := createApp()
|
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 {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user