Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crhntr/qyt
Run yq across git branches!
https://github.com/crhntr/qyt
Last synced: about 2 months ago
JSON representation
Run yq across git branches!
- Host: GitHub
- URL: https://github.com/crhntr/qyt
- Owner: crhntr
- License: other
- Created: 2021-05-05T01:49:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-21T21:36:24.000Z (7 months ago)
- Last Synced: 2024-06-21T13:04:31.314Z (6 months ago)
- Language: Go
- Homepage:
- Size: 358 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# QYT lets you run yq across git branches!
```
qyt [options]
```See [yq docs](https://mikefarah.gitbook.io/yq/) for query syntax.
## Examples
### Read the name value from every yaml file
```sh
qyt query '.name' '*.yml'
```### Display the top level keys for each file on each branch
```sh
qyt query '{"b": $branch, "fp": $filename, "keys": keys}' '*.yml'
```## Committing Query Results
You can update files in each branch by configuring a commit message.
qyu writes the result of the query to the source file and adds all the
modified files to a commit.The commit message is executed as a template with a populated
"CommitMessageData" data structure.```go
type CommitMessageData struct {
Branch string
Query string
}
```For example when you run the following command (with branches main, and rel/2.0)
```sh
qyt apply -m 'run {{printf "%q" .Query}} on {{.Branch}}' 'del(.name)' data.yml
```The commit messages will look like
```
run "del(.name)" on main
```
and
```
run "del(.name)" on rel/2.0
```See [text/templates](https://golang.org/pkg/text/template/) for template syntax.