Skip to content

Commit

Permalink
Add a way to provide inline object to scope directly from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
stirante committed Jan 27, 2025
1 parent 4093a9a commit bf03bcc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ func getScope(scope []string, timeout int64) (*types.JsonObject, error) {
assertionFiles := map[string]string{}
result := types.NewJsonObject()
for _, path := range scope {
if strings.HasPrefix(path, "{") {
json, err := types.ParseJsonObject([]byte(path))
if err != nil {
return types.NewJsonObject(), burrito.WrapErrorf(err, "An error occurred while parsing inline scope '%s'", path)
}
result = types.MergeObject(result, json, false, "#")
continue
}
err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
if err != nil {
if os.IsNotExist(err) {
Expand Down

0 comments on commit bf03bcc

Please sign in to comment.