yaml-parser
处理yaml
、yml
文件的自定义注解解析
使用
$ yaml-parser --help
Handles custom annotation parsing of YAML files
Usage:
yaml-parser [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
param Extract parameters from a single yaml file
split Dividing a YAML file into multiple
Flags:
-h, --help help for yaml-parser
Use "yaml-parser [command] --help" for more information about a command.
支持的注解
功能
deploy-helm.yaml
(例子)
name: deploy-helm-stage
tag:
- 111
- 222
---
name: deploy-helm-1
tag:
- 333
- 444
分割split
兼容yaml文件的分隔符---
$ yaml-parser split deploy-helm.yaml
[deploy-helm.yaml] deploy-helm_stage.yaml deploy-helm_1.yaml
name: deploy-helm-stage
tag:
- 111
- 222
name: deploy-helm-1
tag:
- 333
- 444
自定义参数 param
# 获取所有参数
$ yaml-parser param deploy-helm.yaml
[{"key":"namespace","value":"default"},{"key":"release_name","value":"app-1"},{"key":"namespace","value":"default-1"},{"key":"release_name","value":"app-2"}]
# 获取特定key的参数,相同key后面值会覆盖前面
$ yaml-parser param deploy-helm.yaml --key release_name
app-2