@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
var confirmed bool
|
||||
|
||||
err := huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Delete trust center file %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
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"NAME", "CREATED_AT", "UPDATED_AT"}); 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.TrustCenterFiles, nil
|
||||
},
|
||||
)
|
||||
|
||||
@@ -189,6 +189,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
if flagDescription != "" {
|
||||
input["description"] = flagDescription
|
||||
}
|
||||
|
||||
if flagWebsite != "" {
|
||||
input["websiteUrl"] = flagWebsite
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
var confirmed bool
|
||||
|
||||
err := huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Delete reference %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
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"RANK", "NAME", "CREATED_AT", "UPDATED_AT"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
variables["orderBy"] = map[string]any{
|
||||
"field": flagOrderBy,
|
||||
"direction": flagOrderDir,
|
||||
@@ -142,15 +143,19 @@ 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)
|
||||
}
|
||||
|
||||
if resp.Node.TrustCenter == nil {
|
||||
return nil, fmt.Errorf("trust center not found for organization %s", flagOrg)
|
||||
}
|
||||
|
||||
return &resp.Node.TrustCenter.References, nil
|
||||
},
|
||||
)
|
||||
@@ -173,6 +178,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if r.WebsiteUrl != nil {
|
||||
website = *r.WebsiteUrl
|
||||
}
|
||||
|
||||
rows = append(rows, []string{
|
||||
r.ID,
|
||||
r.Name,
|
||||
|
||||
@@ -143,10 +143,12 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
if cmd.Flags().Changed("active") {
|
||||
input["active"] = flagActive
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("search-engine-indexing") {
|
||||
if err := cmdutil.ValidateEnum("search-engine-indexing", flagSearchEngineIndexing, []string{"INDEXABLE", "NOT_INDEXABLE"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input["searchEngineIndexing"] = flagSearchEngineIndexing
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user