untree

command module
v0.0.0-...-fe6a022 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 6 Imported by: 0

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 <prefix>\t<original line>. suitable for grepping, piping, column selecting. eg "all Go handler functions which log under a certain condition" could be

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

examples

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL