-
Notifications
You must be signed in to change notification settings - Fork 1
Text YAML
Vali (naser) Rafinia edited this page Mar 27, 2023
·
4 revisions
nhash text yaml
is a sub-command of nhash
that allows the user to perform various operations on YAML text, such as parsing, formatting, and converting to other formats.
nhash text yaml [<text>] [options]
-
<text>
: Optional. The YAML text to be processed.
-
-f, --file <file>
: The name of a file to read the YAML text from. -
-c, --convert <JSON|XML|YAML>
: Convert the YAML text to the specified format (JSON, XML). -
-o, --output <output>
: The name of a file to write the output to. -
-?, -h, --help
: Show help and usage information.
- To parse YAML text, simply provide the YAML text as an argument:
nhash text yaml 'name: John Doe
age: 30'
Output:
name: John Doe
age: 30
- To read YAML text from a file, use the
-f or --file
option:
nhash text yaml -f input.yaml
- To convert YAML text to JSON, use the
--convert JSON
option:
nhash text yaml 'name: John Doe
age: 30' -c json
Output:
{
"name": "John Doe",
"age": 30
}
- To write the output to a file, use the
--output
option:
nhash text yaml 'name: John Doe
age: 30' -c JSON --output output.json
The output will be written to output.json
.