Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sentriz/untree

like gron, but generalised on indentation
https://github.com/sentriz/untree

Last synced: 19 days ago
JSON representation

like gron, but generalised on indentation

Awesome Lists containing this project

README

        

untree

untree finds and flattens tree-like text, making it easily searchable. for example prefixing all expressions a codebase with their parent function definitions, all HTML tags with their parent tags, or JSON objects their parent keys names.

all that's required is indentation with spaces or tabs

(like gron, but generalised on indentation)

---

### installation

```
$ go install go.senan.xyz/untree@latest
```

### usage

```
$ cmd | untree
$ untree [FILE ...]
```

the output format is `\t`. suitable for grepping, piping, column selecting. eg "all Go handler functions which log under a certain condition" could be

```bash
untree "$(git ls-files "*.go")" \
| grep "func.*Handle.*if.*err :=.*slog.Info" \
| awk '{ print $2 }'`
```

### examples