All Projects → minamijoyo → Hcledit

minamijoyo / Hcledit

Licence: mit
A command line editor for HCL

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Hcledit

Swiftplaygroundscli
Easily generate Swift Playgrounds from your command line 👨‍💻
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Aura.cli
Command-Line Interface tools
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Cli
Upload your templates to codesandbox with a single command 🏖️. This repo has been moved here: https://github.com/codesandbox-app/codesandbox-importers/tree/master/packages/cli
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Cli
Try and use desktop software in your browser without downloading/installing anything.
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Cloudbase Framework
🏆 腾讯云开发 ☁️ 云原生一体化部署工具 🚀 CloudBase Framework:一键部署,不限框架语言,云端一体化开发,基于Serverless 架构。A front-end and back-end integrated deployment tool 🔥 One-click deploy to serverless architecture. https://docs.cloudbase.net/framework
Stars: ✭ 1,389 (+1235.58%)
Mutual labels:  cli
Void Space
Well-Typed Typing Tutor where you Type Types... in space... yup, you heard me
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Bangajs
Bàngá is a CLI generator for scaffolding ExpressJS applications with speed and efficiency.
Stars: ✭ 102 (-1.92%)
Mutual labels:  cli
Typhoon
Minimal and free Kubernetes distribution with Terraform
Stars: ✭ 1,397 (+1243.27%)
Mutual labels:  hcl
Cordless
The Discord terminal client you never knew you wanted.
Stars: ✭ 1,391 (+1237.5%)
Mutual labels:  cli
Cli
Calibre's Node.js API and Command Line Client (CLI)
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Riot Api
Riot League of Legends & DataDragon API wrappers for PHP7
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Speedtest Linux
Get download/upload speeds via speedtest.net or fast.com from command line using Bash script -- suitable for logs. POSIX OSX Linux
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Multivisor
Centralized supervisor WebUI and CLI
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Npm Try
🚆 Quickly try npm packages without writing boilerplate code.
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Nord Termite
An arctic, north-bluish clean and elegant Termite color theme.
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Posce
A note-taking toolkit for your command line.
Stars: ✭ 103 (-0.96%)
Mutual labels:  cli
Zip It And Ship It
Intelligently prepare Node.js Lambda functions for deployment
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Denox
Script runner and workspace configuration for Deno
Stars: ✭ 105 (+0.96%)
Mutual labels:  cli
Mal
MAL: A MyAnimeList Command Line Interface [BROKEN: BLAME MyAnimeList]
Stars: ✭ 104 (+0%)
Mutual labels:  cli
Awesome Cli
A curated list of awesome resources for building immersive CLI experiences.
Stars: ✭ 104 (+0%)
Mutual labels:  cli

hcledit

License: MIT GitHub release GoDoc

Features

  • CLI-friendly: Read HCL from stdin, edit and write to stdout, easily pipe and combine other commands
  • Token-based edit: You can update lots of existing HCL files with automation scripts without losing comments.
  • Schemaless: No dependency on specific HCL application binary or schema
  • Support HCL2 (not HCL1)
  • Available operations:
    • attribute append/get/rm/set
    • block append/get/list/mv/rm
    • body get
    • fmt

The hcledit focuses on editing HCL with command line, doesn't aim for generic query tools. It was originally born for refactoring Terraform configurations, but it's not limited to specific applications. The HCL specification is somewhat generic, so usability takes precedence over strictness if there is room for interpreting meanings in the schemaless approach.

Install

Homebrew

If you are macOS user:

$ brew install minamijoyo/hcledit/hcledit

Download

Download the latest compiled binaries and put it anywhere in your executable path.

https://github.com/minamijoyo/hcledit/releases

Source

If you have Go 1.16+ development environment:

$ git clone https://github.com/minamijoyo/hcledit
$ cd hcledit/
$ make install
$ hcledit version

Usage

$ hcledit --help
A command line editor for HCL

Usage:
  hcledit [command]

Available Commands:
  attribute   Edit attribute
  block       Edit block
  fmt         Format file
  help        Help about any command
  version     Print version

Flags:
  -h, --help   help for hcledit

Use "hcledit [command] --help" for more information about a command.

attribute

$ hcledit attribute --help
Edit attribute

Usage:
  hcledit attribute [flags]
  hcledit attribute [command]

Available Commands:
  append      Append attribute
  get         Get attribute
  rm          Remove attribute
  set         Set attribute

Flags:
  -h, --help   help for attribute

Use "hcledit attribute [command] --help" for more information about a command.

Given the following file:

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"
  }
}
$ cat tmp/attr.hcl | hcledit attribute rm resource.foo.bar.attr1
resource "foo" "bar" {
  nested {
    attr2 = "val2"
  }
}
$ cat tmp/attr.hcl | hcledit attribute append resource.foo.bar.nested.attr3 '"val3"' --newline
resource "foo" "bar" {
  attr1 = "val1"
  nested {
    attr2 = "val2"

    attr3 = "val3"
  }
}

block

$ hcledit block --help
Edit block

Usage:
  hcledit block [flags]
  hcledit block [command]

Available Commands:
  append      Append block
  get         Get block
  list        List block
  mv          Move block (Rename block type and labels)
  rm          Remove block

Flags:
  -h, --help   help for block

Use "hcledit block [command] --help" for more information about a command.

Given the following file:

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"
}
$ cat tmp/block.hcl | hcledit block rm resource.foo.baz
resource "foo" "bar" {
  attr1 = "val1"
}
$ cat tmp/block.hcl | hcledit block append resource.foo.bar block1.label1 --newline
resource "foo" "bar" {
  attr1 = "val1"

  block1 "label1" {
  }
}

resource "foo" "baz" {
  attr1 = "val2"
}

body

$ hcledit body --help
Edit body

Usage:
  hcledit body [flags]
  hcledit body [command]

Available Commands:
  get         Get body

Flags:
  -h, --help   help for body

Use "hcledit body [command] --help" for more information about a command.

Given the following file:

resource "foo" "bar" {
  attr1 = "val1"
  nested {
    attr2 = "val2"
  }
}
$ cat tmp/body.hcl | hcledit body get resource.foo.bar
attr1 = "val1"
nested {
  attr2 = "val2"
}

fmt

$ hcledit fmt --help
Format a file to a caconical style

Usage:
  hcledit fmt [flags]

Flags:
  -h, --help   help for fmt

Given the following file:

$ cat tmp/fmt.hcl
resource "foo" "bar" {
  attr1 = "val1"
  attr2="val2"
}
$ cat tmp/fmt.hcl | hcledit fmt
resource "foo" "bar" {
  attr1 = "val1"
  attr2 = "val2"
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].