YAML_TO_DB(1)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

πŸ’– yaml_to_db(1) πŸ’–

okay so bestie, welcome to the yaml_to_db page πŸŽ€ β€” it's from the User Contributed Perl Documentation section (section 1 of the manual, iykyk), and honestly? it's giving tiny-but-mighty.


✨ NAME ✨

yaml_to_db β€” converts a subset of YAML into fsdb. like, a very specific subset. not all of YAML. we'll get there πŸ’…


🌸 SYNOPSIS 🌸

yaml_to_db <source.yaml

literally that's it. she reads from stdin, she writes to stdout, she slays ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this thing converts a very limited subset of YAML into Fsdb format. limited limited. don't come in here with your fancy full YAML spec, she will not cope 😭

The input is YAML-format (not fsdb β€” important distinction, ngl). It gets parsed as YAML, and the assumption is that the file is an array of dictionary entries. We extract the dictionary names and output that as an fsdb table. cute, right?

We also flatten one level of lists into comma-separated values. one level. that's the deal 🫢

The output is tab-separated fsdb. And yes, before you ask: "Someday more general field separators should be supported." β€” that's straight from the source, bestie, that's a someday problem πŸ’€


πŸ’… OPTIONS πŸ’…

This module also supports the standard fsdb options, so let's go through them one by one, no skipping, we don't do that here πŸ‘‘

  • -d β€” enable debugging output. turn it on when things are being weird πŸ”
  • -i or --input InputSource β€” read from InputSource, which is typically a file name, or "-" for standard input, or (if you're in Perl) IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects. very flexible, we love her 🌈
  • -o or --output OutputDestination β€” write to OutputDestination, typically a file name, or "-" for standard output, or (if you're in Perl) IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects. same energy, output edition πŸ’œ
  • --autorun or --noautorun β€” by default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The --(no)autorun option controls that behavior within Perl. iykyk 🧚
  • --help β€” show help. be nice to her πŸ₯Ί
  • --man β€” show the full manual. you're literally reading it bestie 😭

πŸ“ SAMPLE USAGE πŸ“

πŸ’– Input:

- name: ACM
  role: sponsor
  alttext: ACM, the Association for Computing Machinery
  image: logos/acm-small.jpg
  link:  https://www.acm.org/
  date: 2016-01-01

- name: SIGCOMM
  role: sponsor
  alttext: SIGCOMM, ACM'S Special Interest Group on Communication
  image: logos/sigcommlogo.png
  link:  http://sigcomm.org
  date: 2016-01-02

- name: SIGMETRICS
  role: sponsor
  alttext: SIGMETRICS, ACM'S Special Interest Group on Performance Evaluation
  image: logos/sigmetrics-small.png
  link:  http://www.sigmetrics.org
  date: 2016-01-03

πŸŽ€ Command:

yaml_to_db <gnupod.yaml

⭐ Output:

#fsdb -F t alttext date image link name role
ACM, the Association for Computing Machinery    2016-01-01      logos/acm-small.jpg     https://www.acm.org/    ACM     sponsor
SIGCOMM, ACM'S Special Interest Group on Communication  2016-01-02      logos/sigcommlogo.png   http://sigcomm.org      SIGCOMM sponsor
SIGMETRICS, ACM'S Special Interest Group on Performance Evaluation      2016-01-03      logos/sigmetrics-small.png      http://www.sigmetrics.org       SIGMETRICS      sponsor
#   | yaml_to_db

see how the field names got alphabetized into that #fsdb -F t ... header line? iconic behaviour, honestly πŸ‘‘


🌟 SEE ALSO 🌟

Fsdb. that's the whole list. go read it if you want the full fsdb lore πŸ“š


Copyright (C) 2011-2018 by John Heidemann <johnh@isi.edu>

This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details. open source queen πŸ’–


ngl bestie, the whole "limited subset of YAML" thing is the main character energy of this page β€” don't expect her to handle every YAML file you throw at her, and definitely don't expect configurable separators yet. someday. someday πŸ™ˆ

perl v5.32.1 Β· 2024-08-02 Β· YAML_TO_DB(1) β€” that's the version, the date, and the page name, all wrapped up with a lil bow πŸŽ€ bye bestie, go convert some YAML πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from