Skip to content

Commit

Permalink
Add examples to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
minamijoyo committed Feb 21, 2020
1 parent d837ea7 commit a36029f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions README.md
Expand Up @@ -81,6 +81,32 @@ Flags:
Use "hcledit attribute [command] --help" for more information about a command.
```

Given the following file:

```attr.hcl
resource "foo" "bar" {
attr1 = "val1"
nested {
attr2 = "val2"
}
}
```

```
$ cat tmp/attr.hcl | hcledit attribute get resource.foo.bar.nested.attr2
"val2"
```

```
$ cat tmp/attr.hcl | hcledit attribute set resource.foo.bar.nested.attr2 '"val3"'
resource "foo" "bar" {
attr1 = "val1"
nested {
attr2 = "val3"
}
}
```

### block

```
Expand All @@ -102,6 +128,42 @@ Flags:
Use "hcledit block [command] --help" for more information about a command.
```

Given the following file:

```block.hcl
resource "foo" "bar" {
attr1 = "val1"
}
resource "foo" "baz" {
attr1 = "val2"
}
```

```
$ cat tmp/block.hcl | hcledit block list
resource.foo.bar
resource.foo.baz
```

```
$ cat tmp/block.hcl | hcledit block get resource.foo.bar
resource "foo" "bar" {
attr1 = "val1"
}
```

```
$ cat tmp/block.hcl | hcledit block mv resource.foo.bar resource.foo.qux
resource "foo" "qux" {
attr1 = "val1"
}
resource "foo" "baz" {
attr1 = "val2"
}
```

## License

MIT

0 comments on commit a36029f

Please sign in to comment.