@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
var confirmed bool
|
||||
|
||||
err := huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Delete control %s?", args[0])).
|
||||
Value(&confirmed).
|
||||
@@ -52,6 +53,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !confirmed {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "SECTION_TITLE"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
variables["orderBy"] = map[string]any{
|
||||
"field": flagOrderBy,
|
||||
"direction": flagOrderDir,
|
||||
@@ -139,12 +140,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.Node == nil {
|
||||
return nil, fmt.Errorf("framework %s not found", flagFramework)
|
||||
}
|
||||
|
||||
if resp.Node.Typename != "Framework" {
|
||||
return nil, fmt.Errorf("expected Framework node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
return &resp.Node.Controls, nil
|
||||
},
|
||||
)
|
||||
@@ -167,6 +171,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if c.BestPractice {
|
||||
bp = "Yes"
|
||||
}
|
||||
|
||||
rows = append(rows, []string{
|
||||
c.ID,
|
||||
c.SectionTitle,
|
||||
|
||||
@@ -102,9 +102,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
if cmd.Flags().Changed("section-title") {
|
||||
input["sectionTitle"] = flagSectionTitle
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("name") {
|
||||
input["name"] = flagName
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("description") {
|
||||
if flagDescription == "" {
|
||||
input["description"] = nil
|
||||
@@ -112,15 +114,19 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["description"] = flagDescription
|
||||
}
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("best-practice") {
|
||||
input["bestPractice"] = flagBestPractice
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("maturity-level") {
|
||||
if err := cmdutil.ValidateEnum("maturity-level", flagMaturityLevel, maturityLevelValues); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input["maturityLevel"] = flagMaturityLevel
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("not-implemented-justification") {
|
||||
if flagNotImplementedJustification == "" {
|
||||
input["notImplementedJustification"] = nil
|
||||
|
||||
@@ -143,7 +143,9 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
if c.BestPractice {
|
||||
bp = "Yes"
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Best Practice:"), bp)
|
||||
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Maturity:"), docgen.MaturityLabel(coredata.ControlMaturityLevel(c.MaturityLevel)))
|
||||
if c.MaturityLevel == "NONE" && c.NotImplementedJustification != nil && *c.NotImplementedJustification != "" {
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Justification:"), *c.NotImplementedJustification)
|
||||
|
||||
Reference in New Issue
Block a user