Skip to content

Commit

Permalink
Fix command flags
Browse files Browse the repository at this point in the history
  • Loading branch information
navnitms committed Jan 8, 2025
1 parent 9d65570 commit be54acc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cmd/cli/app/profile/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ var profileStatusCmd = &cobra.Command{
func init() {
profile.ProfileCmd.AddCommand(profileStatusCmd)
// Flags
profileStatusCmd.PersistentFlags().StringP("name", "n", "", "Profile name to get profile status for")
profileStatusCmd.PersistentFlags().StringP("id", "i", "", "ID to get profile status for")
profileStatusCmd.PersistentFlags().StringP("output", "o", app.Table,
fmt.Sprintf("Output format (one of %s)", strings.Join(app.SupportedOutputFormats(), ",")))
// Required
profileStatusCmd.MarkFlagsOneRequired("id", "name")
}
4 changes: 4 additions & 0 deletions cmd/cli/app/profile/status/status_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func init() {
getCmd.Flags().StringP("entity", "e", "", "Entity ID to get profile status for")
getCmd.Flags().StringP("entity-type", "t", "",
fmt.Sprintf("the entity type to get profile status for (one of %s)", entities.KnownTypesCSV()))
getCmd.Flags().StringP("id", "i", "", "ID to get profile status for")
getCmd.Flags().StringP("name", "n", "", "Profile name to get profile status for")

getCmd.MarkFlagsOneRequired("id", "name")
// Required
if err := getCmd.MarkFlagRequired("entity"); err != nil {
getCmd.Printf("Error marking flag required: %s", err)
Expand Down
8 changes: 8 additions & 0 deletions cmd/cli/app/profile/status/status_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package status
import (
"context"
"fmt"
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -84,4 +85,11 @@ func init() {
listCmd.Flags().BoolP("detailed", "d", false, "List all profile violations")
listCmd.Flags().StringP("ruleType", "r", "", "Filter profile status list by rule type")
listCmd.Flags().String("ruleName", "", "Filter profile status list by rule name")

listCmd.Flags().StringP("name", "n", "", "Profile name to list status for")

if err := listCmd.MarkFlagRequired("name"); err != nil {
listCmd.Printf("Error marking flag required: %s", err)
os.Exit(1)
}
}
2 changes: 2 additions & 0 deletions docs/docs/ref/cli/minder_profile_status_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ minder profile status get [flags]
### Options

```
-i, --id string ID to get profile status for
-n, --name string Profile name to get profile status for
-e, --entity string Entity ID to get profile status for
-t, --entity-type string the entity type to get profile status for (one of artifact, build, build_environment, pipeline_run, release, repository, task_run)
-h, --help help for get
Expand Down

0 comments on commit be54acc

Please sign in to comment.