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