https://github.com/avencera/yamine
A simple CLI for combining json and yaml files
https://github.com/avencera/yamine
hacktoberfest json json-parser k8s kubernetes yaml yaml-merger
Last synced: 2 months ago
JSON representation
A simple CLI for combining json and yaml files
- Host: GitHub
- URL: https://github.com/avencera/yamine
- Owner: avencera
- License: apache-2.0
- Created: 2021-07-03T13:45:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-14T15:26:04.000Z (almost 2 years ago)
- Last Synced: 2025-07-02T03:50:42.764Z (3 months ago)
- Topics: hacktoberfest, json, json-parser, k8s, kubernetes, yaml, yaml-merger
- Language: Rust
- Homepage:
- Size: 86.9 KB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# yamine [](https://github.com/avencera/yamine/actions?query=workflow%3A%22Mean+Bean+CI%22)
A simple CLI for combining json and yaml files
## Install
Available via Homebrew/Linuxbrew
`brew install avencera/tap/yamine`
OR
Install from a github release:
`curl -LSfs https://avencera.github.io/yamine/install.sh | sh -s -- --git avencera/yamine`
OR
Install using cargo:
`cargo install yamine` or `cargo binstall yamine`
OR
Download a release directly from github: [github.com/avencera/yamine/releases](https://github.com/avencera/yamine/releases)
## Usage
`yamine --help`
```
Combine JSON/YAML files into a single fileUsage: yamine [OPTIONS] [FILES_OR_FOLDERS]...
Arguments:
[FILES_OR_FOLDERS]... File(s) or folder you want to run inOptions:
-i, --stdin Read from STDIN
-d, --depth Number of folder depth to recurse into [default: 1]
-o, --output Output file name [default: combined.yaml]
--dry-run Default mode
-w, --write Write new output file
-s, --stdout Outputs combined file contents to STDOUT
-f, --format The format for the output file, defaults to yaml [default: yaml] [possible values: yaml, json-array, json-k8s, json]
-h, --help Print help
-V, --version Print version
```## Examples
- Combine all yaml and json files in the current folder and creates `combined.yaml` file
- `yamine -w .`
- Combine all yaml and json files in the current folder and creates a `combined.json` file in `json-k8s` format:
- `yamine --write --format json-k8s --output combined.json .`
- Output the combined file to STDOUT in json format:
- `yamine --stdout -f json .`
- Convert YAML from stdin and output as JSON to stdout
- `pbpaste | yamine --stdin --stdout -f json`## Formats
- `yaml` - a multi document yaml file separated by `---` (a kubernetes multi resource document)
```yaml
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
---
apiVersion: v1
kind: Namespace
metadata:
name: example
---
kind: ServiceAccount
apiVersion: v1
---
apiVersion: v1
kind: Service
---
apiVersion: apps/v1
kind: Deployment
```- `json` - a json file with each combined file being an element in the array
```json
[
{
"apiVersion": "traefik.containo.us/v1alpha1",
"kind": "IngressRoute"
...
},
{
"apiVersion": "v1",
"kind": "Namespace",
...
},
{
"apiVersion": "v1",
"kind": "ServiceAccount",
...
},
{
"apiVersion": "v1",
"kind": "Service",
...
},
]
```- `json-k8s` - a kubernetes multi resource json document ex:
```json
{
"kind": "List",
"apiVersion": "v1",
"items": [
{
"apiVersion": "traefik.containo.us/v1alpha1",
"kind": "IngressRoute"
...
},
{
"apiVersion": "v1",
"kind": "Namespace",
...
},
{
"apiVersion": "v1",
"kind": "ServiceAccount",
...
},
{
"apiVersion": "v1",
"kind": "Service",
...
},
]
}
```