Yaml

Yaml语法很好懂,唯一费解点的就是这anchor, alias和merge这三了,基本格式如下:

anchor:

&<anchor-name>

alias:

*<anchor-name>

merge:

<< : *<anchor-name>

<< : [ *<anchor-name>, *<anchor-name>, … ]

功能其实也很好理解,anchor给配置起一个名字。alias引用该配置。merge和alias也是一样,引用该配置,但是merge功能更复杂,还可以修改或覆盖override原有配置的值。

直接上例子吧:

# 假设有以下定义,每个都用anchor命名
---
- &CENTER { x: 1, y: 2 }
- &LEFT { x: 0, y: 2 }
- &BIG { r: 10 }
- &SMALL { r: 1 }

# 下面这几个写法的效果是相同的

- # Explicit keys
  x: 1
  y: 2
  r: 10
  label: center/big

- # Merge one map
  << : *CENTER
  r: 10
  label: center/big

- # Merge multiple maps
  << : [ *CENTER, *BIG ]
  label: center/big

- # Override
  << : [ *BIG, *LEFT, *SMALL ]
  x: 1
  label: center/big

Ref



《 “Yaml” 》 有 3 条评论

  1. P2860 An Uncommon Presentation of a Common Illness Epstein Barr Virus Resulting in Splenic Infarction how can i get cheap cytotec prices Nonlinearity in pharmacokinetics is observed with increasing doses

  2. If you have a partner, one of you may feel more confused or upset than the other and want to discuss it in greater detail priligy ebay A group of policemen cinnamon lower blood pressure natural to lower blood pressure and shouting inside You are blood pressure meds over the counter lay down your weapons, and strive for leniency Obviously, the police did not expect the robbers to be subdued Everyone in the hall looked at the bureaucracy of the police, and couldn t help laughing together

  3. None of the DNA damage repair pathways showed differential gene expression in tamoxifen resistant cells compared to wild type cells buy priligy 30 mg x 10 pill

回复 agodelo 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

About Me

一位程序员,会弹吉他,喜欢读诗。
有一颗感恩的心,一位美丽的妻子,两个可爱的女儿
mail: geraldlee0825@gmail.com
github: https://github.com/lisuxiaoqi
medium: https://medium.com/@geraldlee0825