Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/zdz1715/yaml-parser

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/zdz1715/yaml-parser

  • v0.1.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

yaml-parser

处理yamlyml文件的自定义注解解析

使用

$ 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.

支持的注解

  • # +parser:tag=value

    适用于split

  • # +parser:param:key1=value1,key2=value2

    适用于param

功能

deploy-helm.yaml(例子)

# +parser:tag=stage
# +parser:param:namespace=default,release_name=app-1
name: deploy-helm-stage
tag:
  - 111
  - 222
---
# +parser:param:namespace=default-1,release_name=app-2
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
  • deploy-helm_stage.yaml
# +parser:tag=stage
# +parser:param:namespace=default,release_name=app-1
name: deploy-helm-stage
tag:
  - 111
  - 222
  • deploy-helm_1.yaml
# +parser:param:namespace=default-1,release_name=app-2
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

FAQs

Package last updated on 04 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc