forked from deref/exo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue.Value Syntax(Final()) for showing effective configuration
- Loading branch information
1 parent
7a34e0f
commit ea17535
Showing
8 changed files
with
56 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
package exocue | ||
|
||
import "cuelang.org/go/cue" | ||
import ( | ||
"cuelang.org/go/cue" | ||
"cuelang.org/go/cue/ast" | ||
) | ||
|
||
type Stack struct { | ||
v cue.Value | ||
func Final(v cue.Value) ast.Node { | ||
return StructToFile(v.Syntax(cue.Final())) | ||
} | ||
|
||
func NewStack(v cue.Value) *Stack { | ||
dumpValue(v) | ||
return &Stack{ | ||
v: v, | ||
} | ||
} | ||
type Stack cue.Value | ||
|
||
func (s *Stack) Eval() cue.Value { | ||
return s.v.Eval() | ||
func (s Stack) Final() ast.Node { | ||
return Final(cue.Value(s)) | ||
} | ||
|
||
func (s *Stack) Component(name string) cue.Value { | ||
func (s Stack) Component(name string) Component { | ||
v := cue.Value(s) | ||
componentPath := cue.MakePath(cue.Str("components"), cue.Str(name)) | ||
res := s.v.LookupPath(componentPath) | ||
return res | ||
res := v.LookupPath(componentPath) | ||
return Component(res) | ||
} | ||
|
||
type Component cue.Value | ||
|
||
func (c Component) Final() ast.Node { | ||
return Final(cue.Value(c)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters