CLI Tool: hsd-convert
hsd-convert is a command-line tool for converting structured data files
between HSD, XML, JSON, YAML, TOML, and HDF5 formats.
Usage
hsd-convert INPUT OUTPUT [options]
hsd-convert --from=FMT --to=FMT < input > output
Examples
File-to-File (auto-detected formats)
# HSD to JSON
hsd-convert dftb_in.hsd dftb_in.json
# XML to HSD
hsd-convert config.xml config.hsd
# JSON to XML
hsd-convert data.json data.xml
Explicit Format Override
# Input has non-standard extension
hsd-convert input.dat output.json --from=hsd
# Force output format
hsd-convert input.hsd output.dat --to=json
Compact Output
# Compact JSON (no indentation)
hsd-convert input.hsd output.json --compact
Stdin/Stdout
# Pipe from stdin to stdout
cat input.xml | hsd-convert --from=xml --to=hsd
# Combine with other tools
hsd-convert --from=hsd --to=json < dftb_in.hsd | jq '.Hamiltonian'
Options
Flag |
Description |
|---|---|
|
Input format ( |
|
Output format ( |
|
Pretty-print output with indentation (default). |
|
Compact output without indentation. |
|
Show help message and exit. |
|
Show version information and exit. |
Format Identifiers
The --from and --to flags accept these format identifiers:
Identifier |
Format |
|---|---|
|
Human-friendly Structured Data |
|
Extensible Markup Language |
|
JavaScript Object Notation |
|
YAML Ain’t Markup Language |
|
Tom’s Obvious Minimal Language |
|
Hierarchical Data Format 5 |
Exit Codes
Code |
Meaning |
|---|---|
0 |
Success |
1 |
Error (parse error, IO error, unsupported format, etc.) |
Building
The CLI tool is built automatically when HSD_DATA_BUILD_APP=ON (the default).
The binary is located at build/app/hsd-convert after building.