Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new cmd: block new <blockType> <labels>... #106

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

niraj8
Copy link
Contributor

@niraj8 niraj8 commented Jan 28, 2025

i was looking for a way to add root blocks to an hcl file.
found this comment in an issue #88 (comment)

the tests i have added are very terraform specific and the hcledit block new <blockType> <labels> may not be the best way to nest this cmd.

let me know in case there's any suggestions to make this better.

Copy link
Owner

@minamijoyo minamijoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @niraj8 Thank you for your contribution! LGTM 👍

FYI:
As an alternative, I considered extending the block append command and adding a special notation, e.g., Top-level dot ., to indicate File as the parent address. However, I was not convinced. Since address notation is not in the HCL specification and such notation is not widely used in any HCL applications, I rejected this idea, thinking it would be better not to add a new special notation.

@minamijoyo minamijoyo merged commit a890b6b into minamijoyo:master Jan 31, 2025
4 checks passed
@minamijoyo
Copy link
Owner

While updating the README, I noticed it might be better to have an optional --newline flag that appends a new line before a new block, similar to the block append command.

@minamijoyo
Copy link
Owner

A subsequent PR #110 has changed the way arguments are received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants