Skip to content

Commit

Permalink
fix(cli): show error on get not existent object (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoLiberali authored Nov 10, 2023
1 parent ba64d01 commit 002190e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CLI/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
cmd "cli/controllers"
"cli/utils"
"encoding/json"
"errors"
"fmt"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -430,6 +431,11 @@ func (n *getObjectNode) execute() (interface{}, error) {
if err != nil {
return nil, err
}

if !strings.Contains(path, "*") && len(objs) == 0 {
return nil, errors.New("object not found")
}

for _, obj := range objs {
cmd.DisplayObject(obj)
}
Expand Down

0 comments on commit 002190e

Please sign in to comment.