Skip to content

Duplicate SSL flag group shows them twice #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mgradm/cmd/install/shared/flags.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ func AddInstallFlags(cmd *cobra.Command) {
cmd.Flags().String("ssl-server-cert", "", L("Server certificate path"))
cmd.Flags().String("ssl-server-key", "", L("Server key path"))

_ = utils.AddFlagHelpGroup(cmd, &utils.Group{ID: "ssl3rd", Title: L("3rd Party SSL Certificate Flags")})
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-ca-intermediate", "ssl3rd")
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-ca-root", "ssl3rd")
_ = utils.AddFlagToHelpGroupID(cmd, "ssl-server-cert", "ssl3rd")
15 changes: 14 additions & 1 deletion shared/utils/flaggroups.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 SUSE LLC
// SPDX-FileCopyrightText: 2025 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0

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

// ContainsGroup checks if the command alrady has a group with the same ID.
func ContainsGroup(cmd *cobra.Command, groupID string) bool {
for _, grp := range commandGroups[cmd] {
if grp.ID == groupID {
return true
}
}
return false
}

// AddFlagHelpGroup adds a new flags group.
func AddFlagHelpGroup(cmd *cobra.Command, groups ...*Group) error {
for _, group := range groups {
if ContainsGroup(cmd, group.ID) {
continue
}
commandGroups[cmd] = append(commandGroups[cmd], *group)
}

1 change: 1 addition & 0 deletions uyuni-tools.changes.cbosdo.duplicate-ssl-group
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove duplicate parameters in mgradm install podman --help