@@ -158,12 +158,15 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
if flagArea == "" {
|
||||
return fmt.Errorf("area is required; pass --area or run interactively")
|
||||
}
|
||||
|
||||
if flagSource == "" {
|
||||
return fmt.Errorf("source is required; pass --source or run interactively")
|
||||
}
|
||||
|
||||
if flagStatus == "" {
|
||||
return fmt.Errorf("status is required; pass --status or run interactively")
|
||||
}
|
||||
|
||||
if flagType == "" {
|
||||
return fmt.Errorf("type is required; pass --type or run interactively")
|
||||
}
|
||||
@@ -179,18 +182,23 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
if flagRequirement != "" {
|
||||
input["requirement"] = flagRequirement
|
||||
}
|
||||
|
||||
if flagActionsToBeImplemented != "" {
|
||||
input["actionsToBeImplemented"] = flagActionsToBeImplemented
|
||||
}
|
||||
|
||||
if flagRegulator != "" {
|
||||
input["regulator"] = flagRegulator
|
||||
}
|
||||
|
||||
if flagOwner != "" {
|
||||
input["ownerId"] = flagOwner
|
||||
}
|
||||
|
||||
if flagLastReviewDate != "" {
|
||||
input["lastReviewDate"] = flagLastReviewDate
|
||||
}
|
||||
|
||||
if flagDueDate != "" {
|
||||
input["dueDate"] = flagDueDate
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
var confirmed bool
|
||||
|
||||
err := huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Delete obligation %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
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "LAST_REVIEW_DATE", "DUE_DATE", "STATUS"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
variables["orderBy"] = map[string]any{
|
||||
"field": flagOrderBy,
|
||||
"direction": flagOrderDir,
|
||||
@@ -138,12 +139,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("organization %s not found", flagOrg)
|
||||
}
|
||||
|
||||
if resp.Node.Typename != "Organization" {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
return &resp.Node.Obligations, nil
|
||||
},
|
||||
)
|
||||
@@ -166,6 +170,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if o.DueDate != nil {
|
||||
dueDate = *o.DueDate
|
||||
}
|
||||
|
||||
rows = append(rows, []string{
|
||||
o.ID,
|
||||
o.Area,
|
||||
|
||||
@@ -96,6 +96,7 @@ func NewCmdPublish(f *cmdutil.Factory) *cobra.Command {
|
||||
if flagOrg == "" {
|
||||
flagOrg = hc.Organization
|
||||
}
|
||||
|
||||
if flagOrg == "" {
|
||||
return fmt.Errorf("organization is required: pass --org or run `prb auth login`")
|
||||
}
|
||||
|
||||
@@ -93,24 +93,31 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
if cmd.Flags().Changed("area") {
|
||||
input["area"] = flagArea
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("source") {
|
||||
input["source"] = flagSource
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("status") {
|
||||
input["status"] = flagStatus
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("type") {
|
||||
input["type"] = flagType
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("requirement") {
|
||||
input["requirement"] = flagRequirement
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("actions-to-be-implemented") {
|
||||
input["actionsToBeImplemented"] = flagActionsToBeImplemented
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("regulator") {
|
||||
input["regulator"] = flagRegulator
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("owner") {
|
||||
if flagOwner == "" {
|
||||
input["ownerId"] = nil
|
||||
@@ -118,9 +125,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["ownerId"] = flagOwner
|
||||
}
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("last-review-date") {
|
||||
input["lastReviewDate"] = flagLastReviewDate
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("due-date") {
|
||||
input["dueDate"] = flagDueDate
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user