psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

New Feature: `onyo tsv-to-yaml` #731

Open aqw opened 1 week ago

aqw commented 1 week ago

A dedicated command to convert tabular data (TSV and CSV) into YAML. It will supplant onyo new --tsv.

Usage:

onyo tsv-to-yaml [-h] [-d, --delimiter] TSV [TSV ...]

Convert tabular files (e.g. TSV, CSV) to YAML files suitable for passing
to onyo new and onyo set.

The header declares the key names to be populated. The values to
populate assets are declared with one line per asset.

The output is printed to stdout as a multiple document YAML file
(each document is separated by a `---` line).

Positional Arguments:
  TSV
                        Paths of tabular files to convert to YAML.

Options:
  -h, --help
                        show this help message and exit
  -d, --delimiter
                        Delimiter for the tabular file. Default is tab.

The output should be printed to the terminal. The user can redirect to a file or pipe the YAML as needed.

Notes: