YAML preprocessor / macro processor

后端 未结 2 684
独厮守ぢ
独厮守ぢ 2021-01-12 14:05

Is there a simple way to use a preproccesor / macro-processor with YAML files? (I.e. I\'m thinking of something along the lines of the C preprocessor)?

We have a lo

2条回答
  •  春和景丽
    2021-01-12 14:39

    # Yamp - YAML Macro-Processor
    # https://github.com/birchb1024/yamp
    
    # in master.yaml
    defmacro:
      name: country
      args: [$COUNTRY$]
      value:
        name: $COUNTRY$
        file: C:\data\{{$COUNTRY$}}
    ---
    # in some file
    - include: [master.yaml]
    
    # Call with wherever needed:
    { country: USA }
    

提交回复
热议问题