-
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.
- Loading branch information
1 parent
e1bb654
commit 51961a8
Showing
21 changed files
with
272 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ diffSets.json | |
dist | ||
vendor | ||
NOTES.txt | ||
terrap-cli |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package files_handler | ||
|
||
import ( | ||
"github.com/hashicorp/hcl/v2/hclwrite" | ||
) | ||
|
||
// Block represents a configuration block, which can contain attributes or nested blocks | ||
type Block struct { | ||
Type string | ||
Attributes []*Attribute | ||
Blocks []*Block | ||
} | ||
|
||
// Init initializes the Block object with the given hclwrite.Block and block type | ||
func (b *Block) Init(block *hclwrite.Block, blockType string) { | ||
b.Type = blockType | ||
b.Attributes = []*Attribute{} | ||
b.Blocks = []*Block{} | ||
|
||
for name, attr := range block.Body().Attributes() { | ||
a := &Attribute{} | ||
a.Init(attr, name) | ||
b.Attributes = append(b.Attributes, a) | ||
} | ||
|
||
for _, nestedBlock := range block.Body().Blocks() { | ||
nested := &Block{} | ||
nested.Init(nestedBlock, nestedBlock.Type()) | ||
b.Blocks = append(b.Blocks, nested) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package parser | ||
|
||
type ComponentRulebook struct { | ||
Versions map[string]Version `json:"versions"` | ||
} |
Oops, something went wrong.