Yash - A script to load YAML file inside shell scripts
yash [-f file] [--scalar|--array|--hash|--count] [path]
Print the content of a node (in YAML):
Check if the reached item is a scalar/array/hash:
yash [--scalar|--array|--hash] [path]
Count the size of a list, the number of keys of a hash (returns 1 for a scalar):
yash --count [path]
Print the values of a list or a hash (at least one line for each element, but some elements can take several lines as they are dumped in YAML)
yash --values [path]
Print the keys of a hash (one line per key, in plain text):
yash --keys [path]
Path is the sequence of array indexes or hash keys needed to reach the wanted node. It can be omitted in order to select the root node.
YAML data can come from the standard input or from the file given by the -f option.
See the tests for more examples.
--keys you should use a while loop instead of a for loop to avoid problems with spaces in values.
yash -f $CONFIG | while read line; do print $line done
Please use rt.cpan.org for tracking bugs. The list of current open bugs is at http://rt.cpan.org/Dist/Display.html?Queue=Yash.
To report a new bug, go to https://rt.cpan.org/Public/Bug/Report.html?Queue=Yash
Copyright (c) 2010 Olivier Schwander <email@example.com>
Yash is free software. You can redistribute it and/or modify it under the same terms as Perl itself.