#yaml #lib #cli #include #binary-data #document

bin+lib yaml-include

A lib and a CLI for recursively parsing "!include" data in yaml files

5 releases (breaking)

0.7.0 Jul 4, 2023
0.6.0 Jun 21, 2023
0.5.0 Jun 21, 2023
0.4.1 Jun 9, 2023
0.3.0 Jun 8, 2023

#2400 in Encoding

Download history 82/week @ 2024-07-26 46/week @ 2024-08-02 66/week @ 2024-08-09 56/week @ 2024-08-16 57/week @ 2024-08-23 44/week @ 2024-08-30 133/week @ 2024-09-06 49/week @ 2024-09-13 76/week @ 2024-09-20 107/week @ 2024-09-27 99/week @ 2024-10-04 65/week @ 2024-10-11 358/week @ 2024-10-18 519/week @ 2024-10-25 509/week @ 2024-11-01 159/week @ 2024-11-08

1,553 downloads per month

GPL-3.0 license

24KB
199 lines

Yaml-include

A cli tool for processing yaml with include documents through !include <path> tag.

it kinda works with json as well see data/simple/other.json

Install

cargo install yaml-include

Features

  • include and parse recursively yaml (and json) files
  • include markdown and txt text files
  • include other types as base64 encoded binary data.
  • by default handle gracefully circular references with !circular tag

Usage

Help

yaml-include --help
A simple cli that output to stdout recursively included data from a yaml file path

Usage: yaml-include [OPTIONS] <FILE_PATH>

Arguments:
  <FILE_PATH>  main yaml file path to process

Options:
  -o, --output-path <OUTPUT_PATH>  optional output path (output to stdout if not set)
  -p, --panic-on-circular          panic on circular reference (default: gracefully handle circular references with !circular tag)
  -h, --help                       Print help
  -V, --version                    Print version

Run

Ex.:

yaml-include data/sample/main.yml > main_inlined.yml

Basically, turns this:

main.yml:

data:
    - !include file_a.yml
    - !include file_b.yml

file_a.yml:

something:
    - this
    - that

file_b.yml:

other:
    - text: !include file_c.txt
    - markdown: !include file_d.md

file_c.txt:

This is some "long" multiline
text file i don't want to edit
inline in a long yaml file

file_d.md:

# This is some markdown data

## I don't want to edit

- inline
- in a long yaml file

Into that:

data:
  - something:
      - this
      - that
  - other:
      - text: |-
          This is some long multiline
          text i don't want to edit
          inline in a long yaml file
      - markdown: |
          # This is some markdown data

          ## I don't want to edit

          - inline
          - in a long yaml file

see data/sample

Dependencies

~5.5–7.5MB
~138K SLoC