mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-13 11:55:38 +00:00
Update cli docs
This commit is contained in:
parent
abda0e38af
commit
720cc8f798
44
README.md
44
README.md
@ -7,6 +7,9 @@ a lightweight and portable command-line YAML processor
|
|||||||
|
|
||||||
The aim of the project is to be the [jq](https://github.com/stedolan/jq) or sed of yaml files.
|
The aim of the project is to be the [jq](https://github.com/stedolan/jq) or sed of yaml files.
|
||||||
|
|
||||||
|
## New version!
|
||||||
|
V3 is officially out - if you've been using v2 and want/need to upgrade, checkout the [upgrade guide](https://mikefarah.gitbook.io/yq/upgrading-from-v2).
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
### On MacOS:
|
### On MacOS:
|
||||||
```
|
```
|
||||||
@ -70,44 +73,39 @@ yq() {
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Written in portable go, so you can download a lovely dependency free binary
|
- Written in portable go, so you can download a lovely dependency free binary
|
||||||
- Deep read a yaml file with a given path
|
- [Deep read a yaml file with a given path expression](https://mikefarah.gitbook.io/yq/commands/read#basic)
|
||||||
- Update a yaml file given a path
|
- [List matching paths of a given path expression](https://mikefarah.gitbook.io/yq/commands/read#path-only)
|
||||||
- Update a yaml file given a script file
|
- Update a yaml file given a [path expression](https://mikefarah.gitbook.io/yq/commands/write-update#basic) or [script file](https://mikefarah.gitbook.io/yq/commands/write-update#basic)
|
||||||
- Update creates any missing entries in the path on the fly
|
- Update creates any missing entries in the path on the fly
|
||||||
- Create a yaml file given a deep path and value
|
- Keeps yaml formatting and comments when updating
|
||||||
- Create a yaml file given a script file
|
- Create a yaml file given a [deep path and value](https://mikefarah.gitbook.io/yq/commands/create#creating-a-simple-yaml-file) or a [script file](https://mikefarah.gitbook.io/yq/commands/create#creating-using-a-create-script)
|
||||||
- Prefix a path to a yaml file
|
- [Prefix a path to a yaml file](https://mikefarah.gitbook.io/yq/commands/prefix)
|
||||||
- Convert from json to yaml
|
- [Convert to/from json to yaml](https://mikefarah.gitbook.io/yq/usage/convert)
|
||||||
- Convert from yaml to json
|
- [Pipe data in by using '-'](https://mikefarah.gitbook.io/yq/commands/read#from-stdin)
|
||||||
- Pipe data in by using '-'
|
- [Merge](https://mikefarah.gitbook.io/yq/commands/merge) multiple yaml files with various options for [overriding](https://mikefarah.gitbook.io/yq/commands/merge#overwrite-values) and [appending](https://mikefarah.gitbook.io/yq/commands/merge#append-values-with-arrays)
|
||||||
- Merge multiple yaml files where each additional file sets values for missing or null value keys.
|
- Supports multiple documents in a single yaml file for [reading](https://mikefarah.gitbook.io/yq/commands/read#multiple-documents), [writing](https://mikefarah.gitbook.io/yq/commands/write-update#multiple-documents) and [merging](https://mikefarah.gitbook.io/yq/commands/merge#multiple-documents)
|
||||||
- Merge multiple yaml files and override previous values.
|
|
||||||
- Merge multiple yaml files and append array values.
|
|
||||||
- Supports multiple documents in a single yaml file
|
|
||||||
|
|
||||||
## [Usage](http://mikefarah.github.io/yq/)
|
## [Usage](https://mikefarah.gitbook.io/yq/)
|
||||||
|
|
||||||
Check out the [documentation](http://mikefarah.github.io/yq/) for more detailed and advanced usage.
|
Check out the [documentation](https://mikefarah.gitbook.io/yq/) for more detailed and advanced usage.
|
||||||
|
|
||||||
```
|
```
|
||||||
yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
yq [flags]
|
yq [flags]
|
||||||
yq [command]
|
yq [command]
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
delete yq d [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
delete yq d [--inplace/-i] [--doc/-d index] sample.yaml 'b.e(name==fred).value'
|
||||||
help Help about any command
|
help Help about any command
|
||||||
merge yq m [--inplace/-i] [--doc/-d index] [--overwrite/-x] [--append/-a] sample.yaml sample2.yaml
|
merge yq m [--inplace/-i] [--doc/-d index] [--overwrite/-x] [--append/-a] sample.yaml sample2.yaml
|
||||||
new yq n [--script/-s script_file] a.b.c newValue
|
new yq n [--script/-s script_file] a.b.c newValue
|
||||||
prefix yq p [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
prefix yq p [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
||||||
read yq r [--doc/-d index] sample.yaml a.b.c
|
read yq r [--printMode/-p pv] sample.yaml 'b.e(name==fr*).value'
|
||||||
write yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml a.b.c newValue
|
write yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml 'b.e(name==fr*).value' newValue
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for yq
|
-h, --help help for yq
|
||||||
-t, --trim trim yaml output (default true)
|
-j, --tojson output as json
|
||||||
-v, --verbose verbose mode
|
-v, --verbose verbose mode
|
||||||
-V, --version Print version information and quit
|
-V, --version Print version information and quit
|
||||||
|
|
||||||
@ -120,8 +118,4 @@ Use "yq [command] --help" for more information about a command.
|
|||||||
3. add unit tests
|
3. add unit tests
|
||||||
4. apply changes to go.mod
|
4. apply changes to go.mod
|
||||||
5. `make [local] build`
|
5. `make [local] build`
|
||||||
6. If required, update the user documentation
|
|
||||||
- Update README.md and/or documentation under the mkdocs folder
|
|
||||||
- `make [local] build-docs`
|
|
||||||
- browse to docs/index.html and check your changes
|
|
||||||
7. profit
|
7. profit
|
||||||
|
@ -10,7 +10,7 @@ func createDeleteCmd() *cobra.Command {
|
|||||||
var cmdDelete = &cobra.Command{
|
var cmdDelete = &cobra.Command{
|
||||||
Use: "delete [yaml_file] [path_expression]",
|
Use: "delete [yaml_file] [path_expression]",
|
||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
Short: "yq d [--inplace/-i] [--doc/-d index] sample.yaml a.b.c",
|
Short: "yq d [--inplace/-i] [--doc/-d index] sample.yaml 'b.e(name==fred).value'",
|
||||||
Example: `
|
Example: `
|
||||||
yq delete things.yaml 'a.b.c'
|
yq delete things.yaml 'a.b.c'
|
||||||
yq delete things.yaml 'a.*.c'
|
yq delete things.yaml 'a.*.c'
|
||||||
|
@ -9,7 +9,7 @@ func createReadCmd() *cobra.Command {
|
|||||||
var cmdRead = &cobra.Command{
|
var cmdRead = &cobra.Command{
|
||||||
Use: "read [yaml_file] [path_expression]",
|
Use: "read [yaml_file] [path_expression]",
|
||||||
Aliases: []string{"r"},
|
Aliases: []string{"r"},
|
||||||
Short: "yq r [--doc/-d index] sample.yaml 'a.b.c'",
|
Short: "yq r [--printMode/-p pv] sample.yaml 'b.e(name==fr*).value'",
|
||||||
Example: `
|
Example: `
|
||||||
yq read things.yaml 'a.b.c'
|
yq read things.yaml 'a.b.c'
|
||||||
yq r - 'a.b.c' # reads from stdin
|
yq r - 'a.b.c' # reads from stdin
|
||||||
|
@ -11,12 +11,12 @@ var (
|
|||||||
GitDescribe string
|
GitDescribe string
|
||||||
|
|
||||||
// Version is main version number that is being run at the moment.
|
// Version is main version number that is being run at the moment.
|
||||||
Version = "3.0.0"
|
Version = "3.0.1"
|
||||||
|
|
||||||
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
||||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
// such as "dev" (in development), "beta", "rc1", etc.
|
// such as "dev" (in development), "beta", "rc1", etc.
|
||||||
VersionPrerelease = "beta"
|
VersionPrerelease = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProductName is the name of the product
|
// ProductName is the name of the product
|
||||||
|
@ -8,7 +8,7 @@ func createWriteCmd() *cobra.Command {
|
|||||||
var cmdWrite = &cobra.Command{
|
var cmdWrite = &cobra.Command{
|
||||||
Use: "write [yaml_file] [path_expression] [value]",
|
Use: "write [yaml_file] [path_expression] [value]",
|
||||||
Aliases: []string{"w"},
|
Aliases: []string{"w"},
|
||||||
Short: "yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml a.b.c newValue",
|
Short: "yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml 'b.e(name==fr*).value' newValue",
|
||||||
Example: `
|
Example: `
|
||||||
yq write things.yaml 'a.b.c' true
|
yq write things.yaml 'a.b.c' true
|
||||||
yq write things.yaml 'a.*.c' true
|
yq write things.yaml 'a.*.c' true
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
- increment version in snapcraft.yaml
|
- increment version in snapcraft.yaml
|
||||||
- commit
|
- commit
|
||||||
- tag git with same version number
|
- tag git with same version number
|
||||||
- be sure to also tag with 'v' for gopkg.in
|
|
||||||
- make sure local build passes
|
- make sure local build passes
|
||||||
- push tag to git
|
- push tag to git
|
||||||
- git push --tags
|
- git push --tags
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.21.0
|
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.23.1
|
||||||
go get golang.org/x/tools/cmd/goimports
|
go get golang.org/x/tools/cmd/goimports
|
@ -1,5 +1,5 @@
|
|||||||
name: yq
|
name: yq
|
||||||
version: '3.0.0-beta'
|
version: '3.0.1'
|
||||||
summary: A lightweight and portable command-line YAML processor
|
summary: A lightweight and portable command-line YAML processor
|
||||||
description: |
|
description: |
|
||||||
The aim of the project is to be the jq or sed of yaml files.
|
The aim of the project is to be the jq or sed of yaml files.
|
||||||
|
Loading…
Reference in New Issue
Block a user