Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shin1x1/yae
YAML aliases expander
https://github.com/shin1x1/yae
golang yaml
Last synced: 3 months ago
JSON representation
YAML aliases expander
- Host: GitHub
- URL: https://github.com/shin1x1/yae
- Owner: shin1x1
- License: mit
- Created: 2019-05-16T14:25:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-25T08:22:28.000Z (over 5 years ago)
- Last Synced: 2024-06-20T10:22:18.140Z (8 months ago)
- Topics: golang, yaml
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 17
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yae - YAML aliases expander
[![Build Status](https://travis-ci.org/shin1x1/yae.svg?branch=master)](https://travis-ci.org/shin1x1/yae)
`yae` is a YAML aliases expander, written by Go.
## Motivation
When refactoring a long YAML using anchor/alias, I created it to make sure that the original YAML and the refactored YAML are identical.
By comparing the original YAML with the refactored YAML output from the `yae` command with `diff`, you can verify that the contents of YAML have not changed.
```
$ diff <(yae original.yaml) <(yae refactored.yaml)
```Since the `yae` command can change the indentation of the list, the sequence of keys, and other parts that are not relevant to the meaning of YAML, the original YAML uses this command to ensure that the diff command does not cause differences in formatting.
## Installation
Download binary from below link.
You can install using `go get`.
```
go get -u github.com/shin1x1/yae
```## Usage
Run the `yae` command with the YAML file path that you want to expand alias as an argument.
```
$ cat original.yaml
---
anchors:
items:
- &book # anchor
name: book
price: 100stocks:
- *book # alias
- <<: *book # alias with overwrite key
price: 200$ yae src.yaml
anchors:
items:
- name: book
price: 100
stocks:
- name: book
price: 100
- name: book
price: 200
```