Skip to content

Commit 34e5532

Browse files
authored
Merge pull request #581 from cbosdo/duplicate-ssl-group
Duplicate SSL flag group shows them twice
2 parents 7e13ce2 + c9f8ee7 commit 34e5532

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

mgradm/cmd/install/shared/flags.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func AddInstallFlags(cmd *cobra.Command) {
2727
cmd.Flags().String("ssl-server-cert", "", L("Server certificate path"))
2828
cmd.Flags().String("ssl-server-key", "", L("Server key path"))
2929

30-
_ = utils.AddFlagHelpGroup(cmd, &utils.Group{ID: "ssl3rd", Title: L("3rd Party SSL Certificate Flags")})
3130
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-ca-intermediate", "ssl3rd")
3231
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-ca-root", "ssl3rd")
3332
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-server-cert", "ssl3rd")

shared/utils/flaggroups.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 SUSE LLC
1+
// SPDX-FileCopyrightText: 2025 SUSE LLC
22
//
33
// SPDX-License-Identifier: Apache-2.0
44

@@ -70,9 +70,22 @@ func usageFunc(cmd *cobra.Command) error {
7070
return origUsageFunc(cmd)
7171
}
7272

73+
// ContainsGroup checks if the command alrady has a group with the same ID.
74+
func ContainsGroup(cmd *cobra.Command, groupID string) bool {
75+
for _, grp := range commandGroups[cmd] {
76+
if grp.ID == groupID {
77+
return true
78+
}
79+
}
80+
return false
81+
}
82+
7383
// AddFlagHelpGroup adds a new flags group.
7484
func AddFlagHelpGroup(cmd *cobra.Command, groups ...*Group) error {
7585
for _, group := range groups {
86+
if ContainsGroup(cmd, group.ID) {
87+
continue
88+
}
7689
commandGroups[cmd] = append(commandGroups[cmd], *group)
7790
}
7891

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Remove duplicate parameters in mgradm install podman --help

0 commit comments

Comments
 (0)