YAWN YAML CLI
A command-line YAML editor that preserves comments and styling.
Based on the Node.js package YAWN YAML.
Installation
npm install yawn-yaml-cli [--global]
Usage
yawn [command]
$(npm bin)/yawn [command]
See yawn --help
for all commands and options, including output format and error handling.
Major commands are listed below.
yawn get
yawn get <file> <path>
Gets the specified entry inside the given YAML file.
Uses lodash.get()
syntax for the path.
yawn set
yawn set <file> <path> <value>
Sets an entry in the given YAML file.
Uses lodash.set()
syntax for the path.
If adding to an existing array, any value higher than the last index will push to the last array index, instead of
inserting null
entries:
users:
- alice
- bob
users:
- alice
- bob
- jim
yawn push
yawn push <file> <path> <value>
Pushes the given value onto the end of an array, creating the array if needed.
users:
- alice
- bob
yawn push users.yaml users "jim"
rm -rf users.yaml; yawn push users.yaml users "alice"