yq

一个轻量级且可移植的命令行 YAML 处理器。 更多信息:https://mikefarah.gitbook.io/yq/.

yq eval {{路径/到/file.yaml}}

yq read {{路径/到/file.yaml}} --colors

yq eval '.[0]' {{路径/到/file.yaml}}

yq read {{路径/到/file.yaml}} '[0]'

yq eval '.{{键}} = "{{值}}"' --inplace {{路径/到/file.yaml}}

yq write --inplace {{路径/到/file.yaml}} '{{键}}' '{{值}}'

yq eval-all 'select(filename == "{{路径/到/file1.yaml}}") * select(filename == "{{路径/到/file2.yaml}}")' {{路径/到/file1.yaml}} {{路径/到/file2.yaml}}

yq merge {{路径/到/file1.yaml}} {{路径/到/file2.yaml}} --colors