Skip to content

Commit b95ebb1

Browse files
Adding equivalent opm index flags to opm registry (#827)
Signed-off-by: Lance Galletti <[email protected]>
1 parent 7a789fe commit b95ebb1

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

cmd/opm/registry/add.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ func newRegistryAddCmd() *cobra.Command {
4040
rootCmd.Flags().String("ca-file", "", "the root certificates to use when --container-tool=none; see docker/podman docs for certificate loading instructions")
4141
rootCmd.Flags().StringP("mode", "", "replaces", "graph update mode that defines how channel graphs are updated. One of: [replaces, semver, semver-skippatch]")
4242
rootCmd.Flags().StringP("container-tool", "c", "none", "tool to interact with container images (save, build, etc.). One of: [none, docker, podman]")
43-
43+
rootCmd.Flags().Bool("overwrite-latest", false, "overwrite the latest bundles (channel heads) with those of the same csv name given by --bundles")
44+
if err := rootCmd.Flags().MarkHidden("overwrite-latest"); err != nil {
45+
logrus.Panic(err.Error())
46+
}
47+
rootCmd.Flags().Bool("enable-alpha", false, "enable unsupported alpha features of the OPM CLI")
48+
if err := rootCmd.Flags().MarkHidden("enable-alpha"); err != nil {
49+
logrus.Panic(err.Error())
50+
}
4451
return rootCmd
4552
}
4653

@@ -78,6 +85,15 @@ func addFunc(cmd *cobra.Command, _ []string) error {
7885
if err != nil {
7986
return err
8087
}
88+
overwrite, err := cmd.Flags().GetBool("overwrite-latest")
89+
if err != nil {
90+
return err
91+
}
92+
93+
enableAlpha, err := cmd.Flags().GetBool("enable-alpha")
94+
if err != nil {
95+
return err
96+
}
8197

8298
if caFile != "" {
8399
if skipTLS {
@@ -97,7 +113,8 @@ func addFunc(cmd *cobra.Command, _ []string) error {
97113
Bundles: bundleImages,
98114
Mode: modeEnum,
99115
ContainerTool: containerTool,
100-
Overwrite: false,
116+
Overwrite: overwrite,
117+
EnableAlpha: enableAlpha,
101118
}
102119

103120
logger := logrus.WithFields(logrus.Fields{"bundles": bundleImages})

0 commit comments

Comments
 (0)