Skip to content

Commit

Permalink
removing brackets around queryTemplate input string (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller authored Oct 7, 2021
1 parent 8f388ed commit ce972e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/flags/c8yQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func BuildCumulocityQuery(cmd *cobra.Command, fixedParts []string, orderBy strin
}

if len(b) > 0 {
queryParts = append(queryParts, "("+string(b)+")")
queryParts = append(queryParts, string(b))
}

if v, err := cmd.Flags().GetString("queryTemplate"); err == nil && v != "" {
Expand Down
18 changes: 18 additions & 0 deletions tests/manual/devices/list/devices_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/reubenmiller/commander/feat/handle-nested-files/schema.json
config:
env:
C8Y_SETTINGS_DEFAULTS_CACHE: true
C8Y_SETTINGS_CACHE_METHODS: GET POST PUT
C8Y_SETTINGS_DEFAULTS_CACHETTL: 100h
C8Y_SETTINGS_DEFAULTS_OUTPUT: csv


tests:
It can build an inventory query via piped input:
command: |
echo "type1" | c8y devices list --queryTemplate "type eq '%s'" --dry |
c8y util show --select pathEncoded
exit-code: 0
stdout:
exactly: |
/inventory/managedObjects?q=$filter=type+eq+'type1'+$orderby=name

0 comments on commit ce972e1

Please sign in to comment.