Crates.io | yaml-patcher |
lib.rs | yaml-patcher |
version | 0.1.1 |
source | src |
created_at | 2021-08-28 18:37:25.137724 |
updated_at | 2021-11-27 09:47:48.299335 |
description | A cli tool to apply patches to YAML files |
homepage | |
repository | https://github.com/Canop/yaml-patcher |
max_upload_size | |
id | 443531 |
size | 14,403 |
A generic patcher for YAML files.
Given a base file and a patch file, yaml-patcher will output a modified file.
The patch file is a list of (path
, value
) where
path
is a space separated list of map keys or array indexes forming a path to the valuevalue
is any kind of YAML value, even structured, and will replace the old valueyaml-patcher --base base.yml --patch patch.yml > patched.yml
This is a simplified example for a real use-case: modifying a Mkdocs file in a build chain.
site_name: OurApp
site_description: 'App Usage & Configuration'
site_url: https://oursite.com/our-app/
dev_addr: '127.0.0.1:8666'
nav:
- Usage:
- Modules & Menus: menus-modules.md
- Product Finder: product-finder.md
- Product Viewer: product-viewer.md
- Rules Editor: ed.md
- Flow Editor: flow-editor.md
- Concepts:
- Flakes: flakes.md
- Product Genealogy: tracking.md
- TRT Flows: trt.md
- Scheduling: scheduling.md
- Configuration:
- Installation: install.md
- World: world.md
- KB: kb.md
- Resc: resc.md
- Nginx: nginx.md
- Internationalization: i18n.md
extra_javascript:
- js/autoclose-tree.js
- js/filter.js
site_description: 'Vroum Vroum'
site_url: http://ourclient.com/some/path
nav 0 Usage:
- Product Finder: product-finder.md
- Product Viewer: product-viewer.md
nav 2 Configuration:
- World: world.md
- KB: kb.md
yaml-patcher -b mkdocs.yml -p our-client-patch.yml > our-client/mkdocs.yml
site_name: OurApp
edit_uri: ""
dev_addr: "127.0.0.1:8666"
nav:
- Usage:
- Modules & Menus: menus-modules.md
- Product Finder: product-finder.md
- Product Viewer: product-viewer.md
- Concepts:
- Flakes: flakes.md
- Product Genealogy: tracking.md
- TRT Flows: trt.md
- Scheduling: scheduling.md
- Configuration:
- World: world.md
- KB: kb.md
extra_javascript:
- js/autoclose-tree.js
- js/filter.js
site_description: Vroum Vroum
site_url: "http://some/other/url"
Right now yaml-patcher only change existing values to new values, because this covers my current needs.
I might add new features, like removing values, or adding them, or applying pattern based replacements.
If you need such feature please tell me.