Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -60,6 +60,7 @@ func NewCmdCancel(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Cancel access review campaign %s?", args[0])).
Value(&confirmed).
@@ -67,6 +68,7 @@ func NewCmdCancel(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -60,6 +60,7 @@ func NewCmdClose(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Close access review campaign %s?", args[0])).
Value(&confirmed).
@@ -67,6 +68,7 @@ func NewCmdClose(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete access review campaign %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
}

View File

@@ -116,6 +116,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -137,12 +138,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.AccessReviewCampaigns, nil
},
)
@@ -154,6 +158,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if campaigns == nil {
campaigns = []campaignNode{}
}
return cmdutil.PrintJSON(f.IOStreams.Out, campaigns)
}

View File

@@ -60,6 +60,7 @@ func NewCmdStart(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Start access review campaign %s?", args[0])).
Value(&confirmed).
@@ -67,6 +68,7 @@ func NewCmdStart(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -131,6 +131,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
if c.StartedAt != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Started:"), cmdutil.FormatTime(*c.StartedAt))
}
if c.CompletedAt != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Completed:"), cmdutil.FormatTime(*c.CompletedAt))
}

View File

@@ -102,6 +102,7 @@ func NewCmdDecideAll(f *cmdutil.Factory) *cobra.Command {
if flagNote != "" {
d["decisionNote"] = flagNote
}
decisions[i] = d
}

View File

@@ -168,6 +168,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -179,6 +180,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
}
filter := map[string]any{}
if flagDecision != "" {
if err := cmdutil.ValidateEnum(
"decision",
@@ -187,8 +189,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["decision"] = flagDecision
}
if flagFlag != "" {
if err := cmdutil.ValidateEnum(
"flag",
@@ -202,8 +206,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["flag"] = flagFlag
}
if flagIncTag != "" {
if err := cmdutil.ValidateEnum(
"incremental-tag",
@@ -212,11 +218,14 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["incrementalTag"] = flagIncTag
}
if cmd.Flags().Changed("is-admin") {
filter["isAdmin"] = *flagIsAdmin
}
if flagAuthMethod != "" {
if err := cmdutil.ValidateEnum(
"auth-method",
@@ -225,8 +234,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["authMethod"] = flagAuthMethod
}
if flagAccountType != "" {
if err := cmdutil.ValidateEnum(
"account-type",
@@ -235,8 +246,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["accountType"] = flagAccountType
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -256,12 +269,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("campaign %s not found", args[0])
}
if resp.Node.Typename != "AccessReviewCampaign" {
return nil, fmt.Errorf("expected AccessReviewCampaign node, got %s", resp.Node.Typename)
}
return &resp.Node.Entries, nil
},
)
@@ -273,6 +289,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if entries == nil {
entries = []entryNode{}
}
return cmdutil.PrintJSON(f.IOStreams.Out, entries)
}
@@ -287,6 +304,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if e.IsAdmin {
admin = "yes"
}
rows = append(rows, []string{
e.ID,
e.Email,

View File

@@ -106,6 +106,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return fmt.Errorf("cannot read CSV file: %w", err)
}
input["csvData"] = string(csvData)
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete access source %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
}

View File

@@ -110,6 +110,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -131,12 +132,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.AccessSources, nil
},
)
@@ -148,6 +152,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if sources == nil {
sources = []sourceNode{}
}
return cmdutil.PrintJSON(f.IOStreams.Out, sources)
}

View File

@@ -92,6 +92,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return fmt.Errorf("cannot read CSV file: %w", err)
}
input["csvData"] = string(csvData)
}

View File

@@ -87,10 +87,12 @@ func NewCmdAPI(f *cmdutil.Factory) *cobra.Command {
if len(args) == 0 && f.IOStreams.IsStdinTTY() {
return fmt.Errorf("query argument is required when not reading from stdin")
}
data, err := io.ReadAll(f.IOStreams.In)
if err != nil {
return fmt.Errorf("cannot read query from stdin: %w", err)
}
query = string(data)
}
@@ -154,6 +156,7 @@ func parseFields(fields []string) (map[string]any, error) {
if err := json.Unmarshal([]byte(value), &parsed); err != nil {
parsed = value
}
vars[key] = parsed
}

View File

@@ -127,6 +127,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagName == "" {
return fmt.Errorf("name is required; pass --name or run interactively")
}
if flagAssetType == "" {
return fmt.Errorf("asset type is required; pass --asset-type or run interactively")
}
@@ -140,12 +141,15 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("amount") {
input["amount"] = flagAmount
}
if flagOwner != "" {
input["ownerId"] = flagOwner
}
if flagDataTypesStored != "" {
input["dataTypesStored"] = flagDataTypesStored
}
if len(flagThirdPartyIDs) > 0 {
input["thirdPartyIds"] = flagThirdPartyIDs
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete asset %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
}

View File

@@ -113,6 +113,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "AMOUNT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -134,12 +135,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.Assets, nil
},
)

View File

@@ -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`")
}

View File

@@ -87,12 +87,15 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("asset-type") {
input["assetType"] = flagAssetType
}
if cmd.Flags().Changed("amount") {
input["amount"] = flagAmount
}
if cmd.Flags().Changed("owner") {
if flagOwner == "" {
input["ownerId"] = nil
@@ -100,9 +103,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["ownerId"] = flagOwner
}
}
if cmd.Flags().Changed("data-types-stored") {
input["dataTypesStored"] = flagDataTypesStored
}
if cmd.Flags().Changed("thirdParty-ids") {
input["thirdPartyIds"] = flagThirdPartyIDs
}

View File

@@ -141,15 +141,19 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagFramework != "" {
input["frameworkId"] = flagFramework
}
if flagState != "" {
input["state"] = flagState
}
if flagValidFrom != "" {
input["validFrom"] = flagValidFrom
}
if flagValidUntil != "" {
input["validUntil"] = flagValidUntil
}
if flagTrustCenterVisibility != "" {
input["trustCenterVisibility"] = flagTrustCenterVisibility
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete audit %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
}

View File

@@ -115,6 +115,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "VALID_FROM", "VALID_UNTIL", "STATE"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -136,12 +137,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.Audits, nil
},
)
@@ -164,10 +168,12 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if a.ValidFrom != nil {
validFrom = *a.ValidFrom
}
validUntil := ""
if a.ValidUntil != nil {
validUntil = *a.ValidUntil
}
rows = append(rows, []string{
a.ID,
a.Name,

View File

@@ -88,15 +88,19 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("state") {
input["state"] = flagState
}
if cmd.Flags().Changed("valid-from") {
input["validFrom"] = flagValidFrom
}
if cmd.Flags().Changed("valid-until") {
input["validUntil"] = flagValidUntil
}
if cmd.Flags().Changed("trust-center-visibility") {
input["trustCenterVisibility"] = flagTrustCenterVisibility
}

View File

@@ -121,6 +121,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -131,15 +132,19 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if flagAction != "" {
filter["action"] = flagAction
}
if flagActorID != "" {
filter["actorId"] = flagActorID
}
if flagResourceType != "" {
filter["resourceType"] = flagResourceType
}
if flagResourceID != "" {
filter["resourceId"] = flagResourceID
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -159,12 +164,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.AuditLogEntries, nil
},
)
@@ -176,6 +184,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if entries == nil {
entries = []auditLogEntry{}
}
return cmdutil.PrintJSON(f.IOStreams.Out, entries)
}

View File

@@ -189,6 +189,7 @@ func NewCmdLogin(f *cmdutil.Factory) *cobra.Command {
if orgsErr == nil && len(orgs) > 0 {
selected := orgs[0].ID
options := make([]huh.Option[string], 0, len(orgs)+1)
for _, org := range orgs {
options = append(
@@ -199,6 +200,7 @@ func NewCmdLogin(f *cmdutil.Factory) *cobra.Command {
),
)
}
options = append(
options,
huh.NewOption("Skip (no default)", ""),
@@ -260,6 +262,7 @@ func normalizeHostToURL(host string) string {
if strings.HasPrefix(lower, "http://") || strings.HasPrefix(lower, "https://") {
return strings.TrimRight(host, "/")
}
return "https://" + strings.TrimRight(host, "/")
}
@@ -279,6 +282,7 @@ func fetchDiscovery(client *http.Client, baseURL string) (*oidcDiscovery, error)
if err != nil {
return nil, fmt.Errorf("cannot fetch discovery document: %w", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
@@ -327,6 +331,7 @@ func requestDeviceCode(
if err != nil {
return nil, fmt.Errorf("cannot request device code: %w", err)
}
defer func() { _ = resp.Body.Close() }()
body, err := io.ReadAll(resp.Body)
@@ -391,6 +396,7 @@ func pollForToken(
body, err := io.ReadAll(resp.Body)
_ = resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("cannot read token response: %w", err)
}
@@ -400,6 +406,7 @@ func pollForToken(
if err := json.Unmarshal(body, &token); err != nil {
return nil, fmt.Errorf("cannot decode token response: %w", err)
}
return &token, nil
}

View File

@@ -64,6 +64,7 @@ func NewCmdLogout(f *cmdutil.Factory) *cobra.Command {
for i, h := range hosts {
options[i] = huh.NewOption(h, h)
}
err := huh.NewSelect[string]().
Title("Select a host to log out of").
Options(options...).
@@ -85,6 +86,7 @@ func NewCmdLogout(f *cmdutil.Factory) *cobra.Command {
revokeTokens(flagHost, hc, f)
delete(cfg.Hosts, flagHost)
if cfg.ActiveHost == flagHost {
cfg.ActiveHost = ""
}
@@ -152,6 +154,7 @@ func fetchRevocationEndpoint(client *http.Client, baseURL string) (*oidcDiscover
if err != nil {
return nil, fmt.Errorf("cannot fetch discovery document: %w", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
@@ -194,6 +197,7 @@ func revokeToken(
if err != nil {
return fmt.Errorf("cannot send revocation request: %w", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
@@ -208,5 +212,6 @@ func normalizeHostToURL(host string) string {
if strings.HasPrefix(lower, "http://") || strings.HasPrefix(lower, "https://") {
return strings.TrimRight(host, "/")
}
return "https://" + strings.TrimRight(host, "/")
}

View File

@@ -46,6 +46,7 @@ func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
if host == cfg.ActiveHost {
label += " (active)"
}
_, _ = fmt.Fprintf(
f.IOStreams.Out,
"%s\n",
@@ -56,6 +57,7 @@ func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
if hc.Token != "" {
tokenStatus = "set"
}
_, _ = fmt.Fprintf(
f.IOStreams.Out,
" Token: %s\n",

View File

@@ -46,6 +46,7 @@ func TokenRefreshOption(
hc.Token = accessToken
hc.RefreshToken = refreshToken
cfg.Hosts[host] = hc
return cfg.Save()
},
})

View File

@@ -39,6 +39,7 @@ func AddOutputFlag(cmd *cobra.Command) *string {
"",
"Output format: json, table (default)",
)
return &output
}
@@ -65,6 +66,7 @@ func ValidateEnum(flag string, value string, allowed []string) error {
if slices.Contains(allowed, value) {
return nil
}
return fmt.Errorf(
"invalid --%s value %q: valid values are %s",
flag,

View File

@@ -26,6 +26,8 @@ func PrintJSON(out io.Writer, v any) error {
if err != nil {
return fmt.Errorf("cannot marshal JSON: %w", err)
}
_, err = fmt.Fprintln(out, string(data))
return err
}

View File

@@ -32,6 +32,7 @@ func NewTable(headers ...string) *table.Table {
if row == table.HeaderRow {
return headerStyle
}
return cellStyle
})
}

View File

@@ -23,5 +23,6 @@ func FormatTime(raw string) string {
if err != nil {
return raw
}
return t.Local().Format("Jan 02, 2006 15:04 MST")
}

View File

@@ -56,6 +56,7 @@ PowerShell:
DisableFlagsInUseLine: true,
RunE: func(cmd *cobra.Command, args []string) error {
out := f.IOStreams.Out
switch args[0] {
case "bash":
return cmd.Root().GenBashCompletionV2(out, true)

View File

@@ -39,6 +39,7 @@ func NewCmdConfigList(f *cmdutil.Factory) *cobra.Command {
if val == "" {
val = ""
}
_, _ = fmt.Fprintf(f.IOStreams.Out, "%s=%s\n", key, val)
}

View File

@@ -105,12 +105,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("action") {
filter["action"] = flagAction
}
if cmd.Flags().Changed("visitor-id") {
filter["visitorId"] = flagVisitorID
}
if cmd.Flags().Changed("version") {
filter["version"] = flagVersion
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -130,12 +133,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("cookie banner %s not found", flagBannerID)
}
if resp.Node.Typename != "CookieBanner" {
return nil, fmt.Errorf("expected CookieBanner node, got %s", resp.Node.Typename)
}
return &resp.Node.ConsentRecords, nil
},
)
@@ -158,10 +164,12 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if r.Regulation != nil {
regulation = *r.Regulation
}
countryCode := "-"
if r.CountryCode != nil {
countryCode = *r.CountryCode
}
rows = append(rows, []string{r.ID, r.VisitorID, r.Action, r.SDKVersion, regulation, countryCode, r.CreatedAt})
}

View File

@@ -118,19 +118,24 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("ID:"), v.ID)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Visitor ID:"), v.VisitorID)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Action:"), v.Action)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("SDK Version:"), v.SdkVersion)
if v.Regulation != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Regulation:"), *v.Regulation)
}
if v.CountryCode != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Country Code:"), *v.CountryCode)
}
if v.IPAddress != nil && *v.IPAddress != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("IP Address:"), *v.IPAddress)
}
if v.UserAgent != nil && *v.UserAgent != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("User Agent:"), *v.UserAgent)
}
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Consent Data:"), v.ConsentData)
_, _ = fmt.Fprintln(out)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))

View File

@@ -86,6 +86,7 @@ func NewCmdGet(f *cmdutil.Factory) *cobra.Command {
if orgID == "" {
orgID = hc.Organization
}
if orgID == "" {
return fmt.Errorf("organization ID is required: pass --org or run `prb auth login`")
}

View File

@@ -82,6 +82,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if orgID == "" {
orgID = hc.Organization
}
if orgID == "" {
return fmt.Errorf("organization ID is required: pass --org or run `prb auth login`")
}
@@ -93,15 +94,19 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("product") {
input["product"] = flagProduct
}
if cmd.Flags().Changed("architecture") {
input["architecture"] = flagArchitecture
}
if cmd.Flags().Changed("team") {
input["team"] = flagTeam
}
if cmd.Flags().Changed("processes") {
input["processes"] = flagProcesses
}
if cmd.Flags().Changed("customers") {
input["customers"] = flagCustomers
}

View File

@@ -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
}

View File

@@ -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,

View File

@@ -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

View File

@@ -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)

View File

@@ -85,6 +85,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagOrg == "" {
flagOrg = hc.Organization
}
if flagOrg == "" {
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
}
@@ -95,11 +96,13 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
return err
}
}
if flagOrigin == "" {
if err := huh.NewInput().Title("Website origin (e.g. https://example.com)").Value(&flagOrigin).Run(); err != nil {
return err
}
}
if flagCookiePolicyUrl == "" {
if err := huh.NewInput().Title("Cookie policy URL").Value(&flagCookiePolicyUrl).Run(); err != nil {
return err
@@ -110,9 +113,11 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagName == "" {
return fmt.Errorf("name is required; pass --name or run interactively")
}
if flagOrigin == "" {
return fmt.Errorf("origin is required; pass --origin or run interactively")
}
if flagCookiePolicyUrl == "" {
return fmt.Errorf("cookie-policy-url is required; pass --cookie-policy-url or run interactively")
}

View File

@@ -43,10 +43,12 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
if !f.IOStreams.IsInteractive() {
return fmt.Errorf("cannot delete cookie banner: confirmation required, use --yes to confirm")
}
var confirmed bool
if err := huh.NewConfirm().Title(fmt.Sprintf("Delete cookie banner %s?", args[0])).Value(&confirmed).Run(); err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -93,6 +93,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if flagOrg == "" {
flagOrg = hc.Organization
}
if flagOrg == "" {
return fmt.Errorf("organization is required; pass --org or set a default with 'prb auth login'")
}
@@ -114,12 +115,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.CookieBanners, nil
},
)

View File

@@ -48,6 +48,7 @@ func NewCmdTranslate(f *cmdutil.Factory) *cobra.Command {
if flagLanguage == "" {
return fmt.Errorf("--language is required")
}
if flagTranslations == "" {
return fmt.Errorf("--translations is required")
}

View File

@@ -80,15 +80,19 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("cookie-policy-url") {
input["cookiePolicyUrl"] = flagCookiePolicyUrl
}
if cmd.Flags().Changed("privacy-policy-url") {
input["privacyPolicyUrl"] = flagPrivacyPolicyUrl
}
if cmd.Flags().Changed("consent-expiry-days") {
input["consentExpiryDays"] = flagConsentExpiry
}
if cmd.Flags().Changed("default-language") {
input["defaultLanguage"] = flagDefaultLanguage
}

View File

@@ -122,10 +122,12 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("State:"), v.State)
_, _ = fmt.Fprintf(out, "%s%d days\n", label.Render("Consent Expiry:"), v.ConsentExpiryDays)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Default Language:"), v.DefaultLanguage)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Cookie Policy:"), v.CookiePolicyUrl)
if v.PrivacyPolicyUrl != nil && *v.PrivacyPolicyUrl != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Privacy Policy:"), *v.PrivacyPolicyUrl)
}
_, _ = fmt.Fprintln(out)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt))

View File

@@ -94,11 +94,13 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
return err
}
}
if flagSlug == "" {
if err := huh.NewInput().Title("Category slug").Value(&flagSlug).Run(); err != nil {
return err
}
}
if flagDescription == "" {
if err := huh.NewText().Title("Description").Value(&flagDescription).Run(); err != nil {
return err
@@ -109,6 +111,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagName == "" {
return fmt.Errorf("name is required; pass --name or run interactively")
}
if flagSlug == "" {
return fmt.Errorf("slug is required; pass --slug or run interactively")
}

View File

@@ -46,10 +46,12 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
if !f.IOStreams.IsInteractive() {
return fmt.Errorf("cannot delete cookie category: confirmation required, use --yes to confirm")
}
var confirmed bool
if err := huh.NewConfirm().Title(fmt.Sprintf("Delete cookie category %s?", args[0])).Value(&confirmed).Run(); err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -113,12 +113,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("cookie banner %s not found", flagBannerID)
}
if resp.Node.Typename != "CookieBanner" {
return nil, fmt.Errorf("expected CookieBanner node, got %s", resp.Node.Typename)
}
return &resp.Node.Categories, nil
},
)

View File

@@ -84,9 +84,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("slug") {
input["slug"] = flagSlug
}
if cmd.Flags().Changed("description") {
input["description"] = flagDescription
}

View File

@@ -119,13 +119,16 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Slug:"), v.Slug)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Description:"), v.Description)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Kind:"), v.Kind)
_, _ = fmt.Fprintf(out, "%s%d\n", label.Render("Rank:"), v.Rank)
if len(v.GcmConsentTypes) > 0 {
_, _ = fmt.Fprintf(out, "%s%v\n", label.Render("GCM Consent Types:"), v.GcmConsentTypes)
}
if v.PosthogConsent != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("PostHog Consent:"), v.PosthogConsent)
}
_, _ = fmt.Fprintln(out)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt))

View File

@@ -125,6 +125,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagName == "" {
return fmt.Errorf("name is required; pass --name or run interactively")
}
if flagClassification == "" {
return fmt.Errorf("data classification is required; pass --data-classification or run interactively")
}
@@ -138,6 +139,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagOwner != "" {
input["ownerId"] = flagOwner
}
if len(flagThirdPartyIDs) > 0 {
input["thirdPartyIds"] = flagThirdPartyIDs
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete datum %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
}

View File

@@ -111,6 +111,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "NAME", "DATA_CLASSIFICATION"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -132,12 +133,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(raw, &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.Data, nil
},
)

View File

@@ -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`")
}

View File

@@ -83,9 +83,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("data-classification") {
input["dataClassification"] = flagClassification
}
if cmd.Flags().Changed("owner") {
if flagOwner == "" {
input["ownerId"] = nil
@@ -93,6 +95,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["ownerId"] = flagOwner
}
}
if cmd.Flags().Changed("thirdParty-ids") {
input["thirdPartyIds"] = flagThirdPartyIDs
}

View File

@@ -157,9 +157,11 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagTitle == "" {
return fmt.Errorf("title is required; pass --title or run interactively")
}
if flagDocumentType == "" {
return fmt.Errorf("document type is required; pass --document-type or run interactively")
}
if flagClassification == "" {
return fmt.Errorf("classification is required; pass --classification or run interactively")
}
@@ -199,6 +201,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
input["trustCenterVisibility"] = flagTrustCenterVisibility
}

View File

@@ -47,6 +47,7 @@ func NewCmdDeleteDraft(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete draft for document %s?", args[0])).
Value(&confirmed).
@@ -54,6 +55,7 @@ func NewCmdDeleteDraft(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete document %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
}

View File

@@ -109,6 +109,7 @@ func NewCmdListApprovalDecisions(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
if err := cmdutil.ValidateEnum(
"order-direction",
flagOrderDir,
@@ -116,6 +117,7 @@ func NewCmdListApprovalDecisions(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -137,12 +139,15 @@ func NewCmdListApprovalDecisions(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(data, &resp); err != nil {
return nil, err
}
if resp.Node == nil {
return nil, fmt.Errorf("approval quorum %s not found", args[0])
}
if resp.Node.Typename != "DocumentVersionApprovalQuorum" {
return nil, fmt.Errorf("expected DocumentVersionApprovalQuorum node, got %s", resp.Node.Typename)
}
return &resp.Node.Decisions, nil
},
)

View File

@@ -101,6 +101,7 @@ func NewCmdListApprovalQuorums(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
if err := cmdutil.ValidateEnum(
"order-direction",
flagOrderDir,
@@ -108,6 +109,7 @@ func NewCmdListApprovalQuorums(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -129,12 +131,15 @@ func NewCmdListApprovalQuorums(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(data, &resp); err != nil {
return nil, err
}
if resp.Node == nil {
return nil, fmt.Errorf("document version %s not found", args[0])
}
if resp.Node.Typename != "DocumentVersion" {
return nil, fmt.Errorf("expected DocumentVersion node, got %s", resp.Node.Typename)
}
return &resp.Node.ApprovalQuorums, nil
},
)

View File

@@ -117,6 +117,7 @@ func NewCmdListVersions(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
if err := cmdutil.ValidateEnum(
"order-direction",
flagOrderDir,
@@ -124,6 +125,7 @@ func NewCmdListVersions(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -138,6 +140,7 @@ func NewCmdListVersions(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
variables["filter"] = map[string]any{
"statuses": []string{flagStatus},
}
@@ -158,12 +161,15 @@ func NewCmdListVersions(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(data, &resp); err != nil {
return nil, err
}
if resp.Node == nil {
return nil, fmt.Errorf("document %s not found", args[0])
}
if resp.Node.Typename != "Document" {
return nil, fmt.Errorf("expected Document node, got %s", resp.Node.Typename)
}
return &resp.Node.Versions, nil
},
)

View File

@@ -132,6 +132,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
if err := cmdutil.ValidateEnum(
"order-direction",
flagOrderDir,
@@ -139,6 +140,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -149,6 +151,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if flagQuery != "" {
filter["query"] = flagQuery
}
if flagWriteMode != "" {
if err := cmdutil.ValidateEnum(
"write-mode",
@@ -157,8 +160,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["writeModes"] = []string{flagWriteMode}
}
if flagDocumentType != "" {
if err := cmdutil.ValidateEnum(
"document-type",
@@ -167,8 +172,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["documentTypes"] = []string{flagDocumentType}
}
if flagClassification != "" {
if err := cmdutil.ValidateEnum(
"classification",
@@ -177,8 +184,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["classifications"] = []string{flagClassification}
}
if flagStatus != "" {
if err := cmdutil.ValidateEnum(
"status",
@@ -187,8 +196,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
filter["status"] = []string{flagStatus}
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -208,12 +219,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.Documents, nil
},
)
@@ -235,12 +249,14 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
title := ""
docType := ""
classification := ""
if len(doc.Versions.Edges) > 0 {
v := doc.Versions.Edges[0].Node
title = v.Title
docType = v.DocumentType
classification = v.Classification
}
rows = append(rows, []string{
doc.ID,
title,

View File

@@ -130,6 +130,7 @@ instead of publishing immediately. Approvers are ignored with --minor.`,
v.Minor,
v.Status,
)
return nil
}

View File

@@ -99,9 +99,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("title") {
input["title"] = flagTitle
}
if cmd.Flags().Changed("content") {
input["content"] = flagContent
}
if cmd.Flags().Changed("document-type") {
if err := cmdutil.ValidateEnum(
"document-type",
@@ -110,8 +112,10 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
input["documentType"] = flagDocumentType
}
if cmd.Flags().Changed("classification") {
if err := cmdutil.ValidateEnum(
"classification",
@@ -120,8 +124,10 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
input["classification"] = flagClassification
}
if cmd.Flags().Changed("trust-center-visibility") {
if err := cmdutil.ValidateEnum(
"trust-center-visibility",
@@ -130,6 +136,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
); err != nil {
return err
}
input["trustCenterVisibility"] = flagTrustCenterVisibility
}

View File

@@ -142,6 +142,7 @@ func NewCmdViewApprovalDecision(f *cmdutil.Factory) *cobra.Command {
if d.DecidedAt != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Decided:"), cmdutil.FormatTime(*d.DecidedAt))
}
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(d.CreatedAt))
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(d.UpdatedAt))

View File

@@ -141,6 +141,7 @@ func NewCmdViewVersion(f *cmdutil.Factory) *cobra.Command {
if v.PublishedAt != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Published:"), cmdutil.FormatTime(*v.PublishedAt))
}
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt))

View File

@@ -113,15 +113,19 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagDescription != "" {
input["description"] = flagDescription
}
if flagNecessityAndProportionality != "" {
input["necessityAndProportionality"] = flagNecessityAndProportionality
}
if flagPotentialRisk != "" {
input["potentialRisk"] = flagPotentialRisk
}
if flagMitigations != "" {
input["mitigations"] = flagMitigations
}
if flagResidualRisk != "" {
input["residualRisk"] = flagResidualRisk
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete data protection impact assessment %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
}

View File

@@ -59,6 +59,7 @@ func truncate(s string, max int) string {
if len(s) <= max {
return s
}
return s[:max-3] + "..."
}
@@ -115,6 +116,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -136,12 +138,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.DataProtectionImpactAssessments, nil
},
)

View File

@@ -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`")
}

View File

@@ -84,15 +84,19 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("description") {
input["description"] = flagDescription
}
if cmd.Flags().Changed("necessity") {
input["necessityAndProportionality"] = flagNecessityAndProportionality
}
if cmd.Flags().Changed("potential-risk") {
input["potentialRisk"] = flagPotentialRisk
}
if cmd.Flags().Changed("mitigations") {
input["mitigations"] = flagMitigations
}
if cmd.Flags().Changed("residual-risk") {
input["residualRisk"] = flagResidualRisk
}

View File

@@ -50,11 +50,14 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
if !f.IOStreams.IsInteractive() {
return fmt.Errorf("cannot delete evidence: confirmation required, use --yes to confirm")
}
var confirmed bool
err := huh.NewConfirm().Title(fmt.Sprintf("Delete evidence %s?", args[0])).Value(&confirmed).Run()
if err != nil {
return err
}
if !confirmed {
return nil
}

View File

@@ -109,6 +109,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -130,12 +131,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("measure %s not found", flagMeasure)
}
if resp.Node.Typename != "Measure" {
return nil, fmt.Errorf("expected Measure node, got %s", resp.Node.Typename)
}
return &resp.Node.Evidences, nil
},
)
@@ -155,13 +159,16 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
rows := make([][]string, 0, len(evidences))
for _, e := range evidences {
desc := "-"
if e.Description != nil && *e.Description != "" {
d := *e.Description
if len(d) > 60 {
d = d[:57] + "..."
}
desc = d
}
rows = append(rows, []string{
e.ID,
e.Type,

View File

@@ -63,6 +63,7 @@ func NewCmdUpload(f *cmdutil.Factory) *cobra.Command {
if err != nil {
return fmt.Errorf("cannot open file: %w", err)
}
defer func() { _ = file.Close() }()
cfg, err := f.Config()

View File

@@ -148,12 +148,15 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
if n.File != nil {
_, _ = fmt.Fprintf(out, "%s%s (%s)\n", label.Render("File:"), n.File.Filename, n.File.ContentType)
}
if n.URL != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("URL:"), n.URL)
}
if n.Task != nil {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Task:"), n.Task.ID)
}
if n.Description != nil && *n.Description != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Description:"), *n.Description)
}

View File

@@ -80,9 +80,11 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("kind", flagKind, []string{"MINOR_NONCONFORMITY", "MAJOR_NONCONFORMITY", "OBSERVATION", "EXCEPTION"}); err != nil {
return err
}
if err := cmdutil.ValidateEnum("status", flagStatus, []string{"OPEN", "IN_PROGRESS", "CLOSED", "RISK_ACCEPTED", "MITIGATED", "FALSE_POSITIVE"}); err != nil {
return err
}
if err := cmdutil.ValidateEnum("priority", flagPriority, []string{"LOW", "MEDIUM", "HIGH"}); err != nil {
return err
}
@@ -115,27 +117,35 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagOwnerID != "" {
input["ownerId"] = flagOwnerID
}
if flagDescription != "" {
input["description"] = flagDescription
}
if flagSource != "" {
input["source"] = flagSource
}
if flagIdentifiedOn != "" {
input["identifiedOn"] = flagIdentifiedOn
}
if flagRootCause != "" {
input["rootCause"] = flagRootCause
}
if flagCorrectiveAction != "" {
input["correctiveAction"] = flagCorrectiveAction
}
if flagDueDate != "" {
input["dueDate"] = flagDueDate
}
if flagRiskID != "" {
input["riskId"] = flagRiskID
}
if flagEffectivenessChk != "" {
input["effectivenessCheck"] = flagEffectivenessChk
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete finding %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
}

View File

@@ -110,6 +110,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "REFERENCE_ID", "IDENTIFIED_ON", "DUE_DATE", "STATUS", "PRIORITY", "KIND"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -117,12 +118,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
}
filter := map[string]any{}
if flagKind != "" {
if err := cmdutil.ValidateEnum("kind", flagKind, []string{"MINOR_NONCONFORMITY", "MAJOR_NONCONFORMITY", "OBSERVATION", "EXCEPTION"}); err != nil {
return err
}
filter["kind"] = flagKind
}
if len(filter) > 0 {
variables["filter"] = filter
}
@@ -142,12 +146,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", flagOrganization)
}
if resp.Node.Typename != "Organization" {
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
}
return &resp.Node.Findings, nil
},
)
@@ -170,6 +177,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if fi.DueDate != nil {
dueDate = cmdutil.FormatTime(*fi.DueDate)
}
rows = append(rows, []string{
fi.ID,
fi.ReferenceID,

View File

@@ -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`")
}

View File

@@ -98,6 +98,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["description"] = flagDescription
}
}
if cmd.Flags().Changed("source") {
if flagSource == "" {
input["source"] = nil
@@ -105,6 +106,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["source"] = flagSource
}
}
if cmd.Flags().Changed("identified-on") {
if flagIdentifiedOn == "" {
input["identifiedOn"] = nil
@@ -112,6 +114,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["identifiedOn"] = flagIdentifiedOn
}
}
if cmd.Flags().Changed("root-cause") {
if flagRootCause == "" {
input["rootCause"] = nil
@@ -119,6 +122,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["rootCause"] = flagRootCause
}
}
if cmd.Flags().Changed("corrective-action") {
if flagCorrectiveAction == "" {
input["correctiveAction"] = nil
@@ -126,9 +130,11 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["correctiveAction"] = flagCorrectiveAction
}
}
if cmd.Flags().Changed("owner-id") {
input["ownerId"] = flagOwnerID
}
if cmd.Flags().Changed("due-date") {
if flagDueDate == "" {
input["dueDate"] = nil
@@ -136,18 +142,23 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["dueDate"] = flagDueDate
}
}
if cmd.Flags().Changed("status") {
if err := cmdutil.ValidateEnum("status", flagStatus, []string{"OPEN", "IN_PROGRESS", "CLOSED", "RISK_ACCEPTED", "MITIGATED", "FALSE_POSITIVE"}); err != nil {
return err
}
input["status"] = flagStatus
}
if cmd.Flags().Changed("priority") {
if err := cmdutil.ValidateEnum("priority", flagPriority, []string{"LOW", "MEDIUM", "HIGH"}); err != nil {
return err
}
input["priority"] = flagPriority
}
if cmd.Flags().Changed("risk-id") {
if flagRiskID == "" {
input["riskId"] = nil
@@ -155,6 +166,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
input["riskId"] = flagRiskID
}
}
if cmd.Flags().Changed("effectiveness-check") {
if flagEffectivenessChk == "" {
input["effectivenessCheck"] = nil

View File

@@ -156,24 +156,31 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
if n.Description != nil && *n.Description != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Description:"), *n.Description)
}
if n.Source != nil && *n.Source != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Source:"), *n.Source)
}
if n.IdentifiedOn != nil && *n.IdentifiedOn != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Identified On:"), cmdutil.FormatTime(*n.IdentifiedOn))
}
if n.DueDate != nil && *n.DueDate != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Due Date:"), cmdutil.FormatTime(*n.DueDate))
}
if n.RootCause != nil && *n.RootCause != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Root Cause:"), *n.RootCause)
}
if n.CorrectiveAction != nil && *n.CorrectiveAction != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Corrective Action:"), *n.CorrectiveAction)
}
if n.Risk != nil {
_, _ = fmt.Fprintf(out, "%s%s (%s)\n", label.Render("Risk:"), n.Risk.Name, n.Risk.ID)
}
if n.EffectivenessCheck != nil && *n.EffectivenessCheck != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Effectiveness Check:"), *n.EffectivenessCheck)
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete framework %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
}

View File

@@ -106,6 +106,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -127,12 +128,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.Frameworks, nil
},
)
@@ -155,6 +159,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if fw.Description != nil {
desc = *fw.Description
}
rows = append(rows, []string{
fw.ID,
fw.Name,

View File

@@ -81,6 +81,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("description") {
if flagDescription == "" {
input["description"] = nil

View File

@@ -42,6 +42,7 @@ func (s *IOStreams) IsInteractive() bool {
if s.ForceNonInteractive {
return false
}
return s.isStdinTTY() && s.isStdoutTTY()
}
@@ -49,6 +50,7 @@ func (s *IOStreams) isStdinTTY() bool {
if f, ok := s.In.(*os.File); ok {
return term.IsTerminal(int(f.Fd()))
}
return false
}
@@ -56,6 +58,7 @@ func (s *IOStreams) isStdoutTTY() bool {
if f, ok := s.Out.(*os.File); ok {
return term.IsTerminal(int(f.Fd()))
}
return false
}
@@ -67,6 +70,7 @@ func (s *IOStreams) IsStdoutTTY() bool {
if s.ForceNonInteractive {
return false
}
return s.isStdoutTTY()
}
@@ -74,6 +78,7 @@ func (s *IOStreams) ColorEnabled() bool {
if s.ForceNoColor {
return false
}
return s.isStdoutTTY()
}
@@ -96,6 +101,7 @@ func System() *IOStreams {
func Test() (*IOStreams, *bytes.Buffer, *bytes.Buffer) {
out := new(bytes.Buffer)
errOut := new(bytes.Buffer)
return &IOStreams{
In: io.NopCloser(new(bytes.Buffer)),
Out: out,

View File

@@ -120,6 +120,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagName == "" {
return fmt.Errorf("name is required; pass --name or run interactively")
}
if flagCategory == "" {
return fmt.Errorf("category is required; pass --category or run interactively")
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete measure %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
}

View File

@@ -117,6 +117,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "NAME"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -144,12 +145,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.Measures, nil
},
)

View File

@@ -85,16 +85,20 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
if cmd.Flags().Changed("name") {
input["name"] = flagName
}
if cmd.Flags().Changed("description") {
input["description"] = flagDescription
}
if cmd.Flags().Changed("category") {
input["category"] = flagCategory
}
if cmd.Flags().Changed("state") {
if err := cmdutil.ValidateEnum("state", flagState, []string{"NOT_STARTED", "IN_PROGRESS", "NOT_APPLICABLE", "IMPLEMENTED"}); err != nil {
return err
}
input["state"] = flagState
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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,

View File

@@ -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`")
}

View File

@@ -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
}

View File

@@ -127,6 +127,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := json.Unmarshal(data, &resp); err != nil {
return nil, err
}
return &resp.Viewer.Profiles, nil
},
)
@@ -147,6 +148,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
for _, p := range profiles {
orgID := ""
orgName := ""
if p.Organization != nil {
orgID = p.Organization.ID
orgName = p.Organization.Name

View File

@@ -154,15 +154,19 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
if flagPurpose != "" {
input["purpose"] = flagPurpose
}
if flagRole != "" {
input["role"] = flagRole
}
if flagLawfulBasis != "" {
input["lawfulBasis"] = flagLawfulBasis
}
if flagDataSubjectCategory != "" {
input["dataSubjectCategory"] = flagDataSubjectCategory
}
if flagPersonalDataCategory != "" {
input["personalDataCategory"] = flagPersonalDataCategory
}

View File

@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
}
var confirmed bool
err := huh.NewConfirm().
Title(fmt.Sprintf("Delete processing activity %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
}

View File

@@ -113,6 +113,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT", "NAME"}); err != nil {
return err
}
variables["orderBy"] = map[string]any{
"field": flagOrderBy,
"direction": flagOrderDir,
@@ -134,12 +135,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.ProcessingActivities, nil
},
)

Some files were not shown because too many files have changed in this diff Show More