Skip to content

A flag to swap labels and values in the input (Unix "uniq" compatibility) #94

@maxim-kukushkin

Description

@maxim-kukushkin

Termgraph looks like an amazing tool and it could be really useful for some ad-hoc investigations.

When looking at the logs and other texts it's often useful to run some-command | sort | uniq -c which counts unique entries and prints the list of unique values and the number of occurrences. For example:

     16 alter
     17 create
     15 drop
     12 insert
      8 update

Termgraph would fit nicely into this use case, like some-command | sort | uniq -c | termgraph. The issue is that termgraph always expects the label to go first. Of course in the example above it can be solved with Awk for example (like | awk '{print $2, $1}', however first of all it's an extra step (which reduces usability), and also it makes it problematic if the label contains a space.

That said, it would be awesome to have a CLI flag for termgraph like --values-first, which would tell termgraph to read the value in the first column and use the rest of the line as a label.

It would allow termgraph to be used seamlessly in the example above and also provide extra flexibility in other use cases which can use a similar input format

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions