2016-09-27 2 views
1

내가 좋아하는 일을하고 싶습니다 :이 직접 작동하지 않습니다YAML에서 별칭을 연결할 수 있습니까?

opt-flags : &opt_flags -DCMAKE_BUILD_TYPE=Release 
dbg-flags : &dbg_flags -DCMAKE_BUILD_TYPE=Debug 
common-flags: &common -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON 

# concatenate previous definitions to create composed definitions 
dbg: *common *dbg_flags 
opt: *common *opt_flags 

. YAML에서 이와 비슷한 작업을 수행 할 수 있습니까?

답변

0

아니요, 별명이 완전한 노드를 대체합니다. 그러나

당신은 매핑 다루고있는 경우 파서가 새 매핑에 키의 여러 세트를 결합 지원하는 경우, 당신은 merge key language-independent type를 사용할 수 있습니다

opt-flags : &opt_flags -DCMAKE_BUILD_TYPE=Release 
dbg-flags : &dbg_flags -DCMAKE_BUILD_TYPE=Debug 
common-flags: &common -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON 

dbg: 
    << : [&common_flags, &dbg_flags] 
opt: 
    << : [&common_flags, &opt_flags] 

그러나 이것은 두 항목 각각을하고,하지 않을 것이다 앵커링 된 문자열 스칼라를 연결하고 여러 값 ()을 결합 할 수있는 프로그램이 필요합니다. 순서는 보장되지 않습니다..

관련 문제