If you have to edit yaml file on CI/CD pipeline or other situations, just use it.
wget https://github.com/jujumilk3/yamlier/releases/download/v0.2.0/yamlier.{os}.{arcihtecture} -O ./yamlier
chmod +x ./yamlier
Of course, if you want to use it globally, You have to move it into bin
dir
that referenced by your account.
- MacOS(amd64)
$ wget https://github.com/jujumilk3/yamlier/releases/download/v0.2.0/yamlier.darwin.amd64 -O ./yamlier chmod +x ./yamlier ./yamlier edit ./yamlier edit developer.yaml languages.perl poor ./developer-modified.yaml
- github actions (github actions' ubuntu-latest image is amd64 architecture)
... jobs: build: runs-on: ubuntu-latest ... - name: wget uses: wei/wget@v1 with: args: https://github.com/jujumilk3/yamlier/releases/download/v0.2.0/yamlier.linux.amd64 -O yamlier - name: change file mod run: sudo chmod +x ./yamlier - name: run yamlier run: ./yamlier edit ./developer.yaml name changed_name ./developer-yamlier.yaml ...
- yamlier --help
- yamlier edit [flags]
yamlier edit --help
yamlier edit [file_path] [key] [value] | [output_filepath]
- yamlier get [flags]
yamlier get --help
yamlier get [file_path] [key]
# developer.yaml
name: Martin D'vloper
job: Developer
skill: Elite
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
perl: Elite
python: Elite
pascal: Lame
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things
yamlier edit ./developer.yaml name changed_name ./developer-yamlier.yaml
# developer-yamlier.yaml
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things
foods:
- Apple
- Orange
- Strawberry
- Mango
job: Developer
languages:
pascal: Lame
perl: Elite
python: Elite
name: changed_name # name changed
skill: Elite
※ CAUTION: new yaml's keys are ordered.
Also, you can handle deeper values
# developer.yaml
name: Martin D'vloper
job: Developer
skill: Elite
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
perl: Elite
python: Elite
pascal: Lame
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things
yamlier edit ./developer.yaml languages.perl Poor ./developer-yamlier.yaml
# developer-yamlier.yaml
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things
foods:
- Apple
- Orange
- Strawberry
- Mango
job: Developer
languages:
pascal: Lame
perl: Poor # languages.perl changed
python: Elite
name: Martin D'vloper
skill: Elite
If there's no binary file can use at your OS and architecture, just read it and build it yourself.
Or you can request to me by register issue.
git clone [email protected]:jujumilk3/yamlier.git
cd yamlier
go mod tidy
-> install packages and code described atgo.mod
go tool dist list
-> chk dist list# os / architecture aix/ppc64 android/386 android/amd64 android/arm android/arm64 darwin/amd64 darwin/arm64 dragonfly/amd64 freebsd/386 freebsd/amd64 freebsd/arm freebsd/arm64 illumos/amd64 ios/amd64 ios/arm64 js/wasm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/riscv64 linux/s390x netbsd/386 netbsd/amd64 netbsd/arm netbsd/arm64 openbsd/386 openbsd/amd64 openbsd/arm openbsd/arm64 openbsd/mips64 plan9/386 plan9/amd64 plan9/arm solaris/amd64 windows/386 windows/amd64 windows/arm windows/arm64
env GOOS=target-OS GOARCH=target-architecture go build yamlier