@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user