Skip to content

Commit

Permalink
fix uid field in show cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuskimmina committed Jan 2, 2024
1 parent 52a2708 commit 63e7240
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/cnspec/cmd/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,20 @@ var policyShowCmd = &cobra.Command{
}

for _, p := range policies {
var policyName string
if p.Mrn != "" {
index := strings.LastIndex(p.Mrn, "/")
if index == -1 {
policyName = p.Mrn
} else {
policyName = p.Mrn[index+1:]
}
} else {
policyName = ""
}
fmt.Println("→ Name: ", p.Name)
fmt.Println("→ Version: ", p.Version)
fmt.Println("→ UID: ", p.Uid)
fmt.Println("→ UID: ", policyName)
fmt.Println("→ MRN: ", p.Mrn)
fmt.Println("→ License: ", p.License)
fmt.Println("→ Authors: ", p.Authors[0].Name)
Expand Down

0 comments on commit 63e7240

Please sign in to comment.