-
Notifications
You must be signed in to change notification settings - Fork 4
Expected Behavior
Joris Roovers edited this page Aug 25, 2016
·
5 revisions
We use this page to describe expected yamlpal behavior for commands that haven't been implemented yet.
# find should take a format string
$ yamlpal find --format "%line %value %key" "bill-to/address/city" -f examples/sample1.yaml
11: city : Royal Oak
$ yamlpal find --format "%line:%literal" "bill-to/address/city" -f examples/sample1.yaml
11: city : Royal Oak
# Default format: "%key: value"
$ yamlpal find "bill-to/address/city" -f examples/sample1.yaml
city : Royal Oak
# format: "%literal"
$ yamlpal find --literal "bill-to/address/city" -f examples/sample1.yaml
city : Royal Oak
# format: "%line"
$ yamlpal find --line "bill-to/address/city" -f examples/sample1.yaml
11
# format: "%value"
$ yamlpal find --value "bill-to/address/city" -f examples/sample1.yaml
Royal Oak
# finding blocks should also be possible, but this can be an improvement
$ yamlpal find "bill-to/address" -f examples/sample1.yaml
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
$ yamlpal check "bill-to/address/city" "Royal Oak" -f examples/sample1.yaml
# return code is 0
$ yamlpal check "bill-to/address/city" "([a-zA-Z]* ?)+" -f examples/sample1.yaml
# matches "Royal Oak", return code is 0
$ yamlpal check "bill-to/address/city" "[0-9]" -f examples/sample1.yaml
# does not match, return code is 1
ERROR: examples/sample1.yaml: "Royal Oak" does not match "[0-9]"
$ yamlpal check --silent "bill-to/address/city" "[0-9]" -f examples/sample1.yaml
# does not match, return code is 1, no output
# It should take the same format string as find
$ yamlpal check --format "%value" "bill-to/address/city" "Royal Oak" -f examples/sample1.yaml
# With the same convenience parameters
$ yamlpal check --value "bill-to/address/city" "Royal Oak" -f examples/sample1.yaml
# Check whether key is present in block
$ yamlpal check "bill-to/address" "has-key:city" -f examples/sample1.yaml
# Check whether match is a list
$ yamlpal check "type(foo/bar)" "list" -f examples/newsample.yaml
# Check whether list contains value
$ yamlpal check "contains(foo/bar)" "myvalue" -f examples/newsample.yaml
# Check whether a list is of a certain length
$ yamlpal check "length(foo/bar)" 5 -f examples/newsample.yaml
# Check whether a dict has a key
$ yamlpal check "has-key(foo/bar)" "mykey" -f examples/newsample.yaml