cue eval alias.cue | |
cmp stdout expect-stdout-cue | |
-- frontmatter.toml -- | |
title = "Aliases" | |
description = "" | |
-- text.md -- | |
An alias defines a local macro. | |
A typical use case is to provide access to a shadowed field. | |
Aliases are not members of a struct. They can be referred to only within the | |
struct, and they do not appear in the output. | |
-- alias.cue -- | |
A = a // A is an alias for a | |
a: { | |
d: 3 | |
} | |
b: { | |
a: { | |
// A provides access to the outer "a" which would | |
// otherwise be hidden by the inner one. | |
c: A.d | |
} | |
} | |
-- expect-stdout-cue -- | |
a: { | |
d: 3 | |
} | |
b: { | |
a: { | |
c: 3 | |
} | |
} |