ymask - Mask a data structure to display only the desired fields
ymask <mask> [<file>...] ymask -h|--help|--version
This program takes a stream of YAML documents (on STDIN or file arguments), and prints only the fields specified by the
See MASK SYNTAX for more information
A YAML file to read. The special file "-" refers to STDIN. If no files are specified, read STDIN.
-h | --help
Show this help document.
Print the current ymask and Perl versions.
$ ymask 'name,rank,serial'
Select multiple properties in a document using
,. If a property does not exist, nothing will be added (and no error or warning will be output).
$ ymask 'squad/name'
Select an inner document's properties using
/. Arrays are automatically looped over.
$ ymask 'squad(name,location)'
Select multiple parts of an inner document by using parentheses.
$ ymask 'squad/*/city'
Select every property in a document, which is useful for picking parts out of every inner document.
All these examples use the following documents:
--- name: Hazel Murphy role: Captain nickname: Hank history: - location: Sealab from: 2014-01-01 - location: USS Hunley from: 2012-06-01 to: 2013-11-28 --- name: Quinn Quinlan role: Science Officer nickname: Doctor history: - location: Sealab from: 2014-04-01 - location: MIT from: 2008-08-01 to: 2012-06-05 --- name: Debbie Dupree role: Oceanographer history: - location: Sealab from: 2014-02-10 - location: Sea Parks from: 2004-09-01 to: 2014-01-20
SELECT MULTIPLE PROPERTIES
$ ymask 'name,role,nickname' --- name: Hazel Murphy nickname: Hank role: Captain --- name: Quinn Quinlan nickname: Doctor role: Science Officer --- name: Debbie Dupree role: Oceanographer
SELECT PROPERTIES IN ARRAYS
$ ymask 'name,history/location' --- history: - location: Sealab - location: USS Hunley name: Hazel Murphy --- history: - location: Sealab - location: MIT name: Quinn Quinlan --- history: - location: Sealab - location: Sea Parks name: Debbie Dupree
Specify the default format Yertl uses between commands. Defaults to
yaml. Can be set to
jsonfor interoperability with other programs.
Data::Partial::Google - The implementation of this command