hashicorp / hashicorp/hcl

Easier tools for reading/setting/getting keys

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

Hi,
I'm interested in writing a program to update a config file, while preserving the comments in that file. This requires calling `ParseBytes()` or equivalent and then manipulating the resulting `*ast.File`. This is a little cumbersome. I added some helpers for getting/setting keys, in this gist:

https://gist.github.com/kevinburke/477ca3a49d67f886cd2ade96a2abaf2a

They assume the data has a little more structure than HCL provides - no listing two keys for a given ObjectList for example. But they significantly simplify the task of manipulating the AST, which is why I thought you might be interested in adding something like this to the project.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ParseBytes() and the resulting *ast.File, then compare the proposed helpers in the linked gist with the AST structures exposed by HCL. Define how getting and setting keys should handle duplicate keys and other HCL cases; done means a reviewed helper API with coverage for the supported manipulations.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.