Skip to content

sentriz/untree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

like gron, but generalised on indentation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages