Giter Club home page Giter Club logo

Comments (4)

minamijoyo avatar minamijoyo commented on August 24, 2024 1

Hi @nitrocode, thank you for reporting!

The type of last 2 is block rather than attribute. So I expect to get it with hcledit block get.
I tested and confirmed that the top level block seems to be ok, but the nested doesn't.

$ cat test.tf | hcledit block get resource.foo.bar.nested
$ cat test.tf | hcledit block get resource.foo.bar
resource "foo" "bar" {
  attr1 = "val1"
  nested {
    attr2 = "val2"
  }
}

I agree it's natural to expect returning the nested block as the same as the nested attribute. We should support it.

Strictly speaking, the hcledit block get returns not only block body { ... }, but also block header resource "foo" "bar". Do you want to get the block body without the header? if so, we need to support hcledit body get.

from hcledit.

minamijoyo avatar minamijoyo commented on August 24, 2024 1

@nitrocode The hcledit block get command now returns not only the top-level block, but also the nested block. See #22

from hcledit.

minamijoyo avatar minamijoyo commented on August 24, 2024 1

@nitrocode I added hcledit body get command in #23.

The expected behavior you described above contains the outer braces {}, however, according to the HCL spec, the outer braces don't belong to the body.
https://github.com/hashicorp/hcl/blob/v2.9.1/hclsyntax/spec.md#structural-elements

So, I intentionally didn't include them in the outputs.

from hcledit.

nitrocode avatar nitrocode commented on August 24, 2024

Yes I agree with you. I didn't realize there was a block get command.

As you already mentioned, ybese changes would be nice

  • Support body get to retrieve body without header
  • Support block get for blocks

from hcledit.

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.