Giter Site home page Giter Site logo

Support hcl files about dasel HOT 12 OPEN

tomwright avatar tomwright commented on May 12, 2024 9
Support hcl files

from dasel.

Comments (12)

TomWright avatar TomWright commented on May 12, 2024 18

Are we interested in HCL v1, v2 or both?

To save on mass comment replies here maybe add a 👍 for v1 and a 👎 for v2.

from dasel.

nikolay avatar nikolay commented on May 12, 2024 1

@TomWright I've been using hcl2json with jq but hoped that I can use just one. HCL is widely popular in the DevOps world, so, it would great if it's natively supported.

from dasel.

TomWright avatar TomWright commented on May 12, 2024 1

@nikolay I appreciate that and can see the benefit. I'm not saying it's not going to happen, just that I will have to work on it over time rather than a quick change now

from dasel.

TomWright avatar TomWright commented on May 12, 2024 1

Thanks for all the feedback here.

I am currently reworking the encoding/decoding of all supported formats here: #289

Once that is done I will use have a crack at implementing parsers for HCL V2.

from dasel.

TomWright avatar TomWright commented on May 12, 2024

I'm always open to supporting new file formats, as long as they play nicely with other implementations.

I will take a look at HCL 2 and get back to you on this soon.

Thank you for your interest in dasel 🙂

from dasel.

TomWright avatar TomWright commented on May 12, 2024

Hey @josegonzalez,

This looks like it will be a longer term feature since I'll need to write some logic to parse hcl documents into a generic map[string]interface{}.

Short term it looks like you can use a combination of dasel and hcl2json to read hcl documents with dasel.

I'll leave this issue open so I can work on it when I have the time.

from dasel.

josegonzalez avatar josegonzalez commented on May 12, 2024

Thank you @TomWright for looking into this. I very much appreciate it and realize that development of the functionality may not be forthcoming.

from dasel.

TomWright avatar TomWright commented on May 12, 2024

It looks like I can import and directly use hcl2json from my code to make that conversion.

This will allow me to add select support relatively easily, but does not (to my knowledge) allow me to convert JSON -> HCL in order for put commands to work.

from dasel.

josegonzalez avatar josegonzalez commented on May 12, 2024

Maybe useful for turning a json byte array to hcl? https://github.com/hashicorp/hcl/blob/main/json/public.go#L20

from dasel.

TomWright avatar TomWright commented on May 12, 2024

That looks promising.

I also found this repo although it is a little out of data: https://github.com/kvz/json2hcl/blob/master/main.go
I'm not sure if it's for use with hcl v1 or v2.

from dasel.

josegonzalez avatar josegonzalez commented on May 12, 2024

That repo is hclv1. Maybe supporting either via a flag works.

from dasel.

nikolay avatar nikolay commented on May 12, 2024

By the way, there's a tool like jq just for HCL, but it also only supports v1 (for now): hcql.

from dasel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.