Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgla96/yaml-searcher
command line utility for searching through yaml
https://github.com/mgla96/yaml-searcher
command-line-utility yaml
Last synced: about 1 month ago
JSON representation
command line utility for searching through yaml
- Host: GitHub
- URL: https://github.com/mgla96/yaml-searcher
- Owner: Mgla96
- License: apache-2.0
- Created: 2022-01-06T04:00:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-30T14:09:05.000Z (over 2 years ago)
- Last Synced: 2023-03-05T14:39:07.019Z (almost 2 years ago)
- Topics: command-line-utility, yaml
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yaml-searcher
A command line utility to search through yaml for a specific value.It reads yaml from stdin and outputs the value you are searching for.
## Examples
Search in yaml for result of field `hello.world`
**yaml-file.yaml**
```yaml
hello:
world: "output"
```redirect yaml file
```
./yaml-searcher hello.world < yaml-file.yaml
```pipe in yaml file
```
cat yaml-file.yaml | ./yaml-searcher hello.world
```Both will return `output`
## Installation
1. Download yaml-searcher
```bash
curl -L https://github.com/mgla96/yaml-searcher/releases/download/v0.1.5/yaml-searcher > yaml-searcher
```2. Add execution permissions
```bash
chmod +x yaml-searcher
```3. Place in executable PATH or call directly
## Notes / Gotchas
* zsh uses square brackets for globbing/pattern matching
when passing square brackets in search argument for yaml-searcher, you must either escape them or quote argument
**yaml-file.yaml**
```yaml
hello:
- world: "output"
- world: "output2"
```**command**
```bash
./yaml-searcher 'hello[0]' < yaml-file.yaml
```
```bash
./yaml-searcher hello\[0\] < yaml-file.yaml
```
**returns**
```bash
world: output
```