Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maxim-kukushkin opened this issue Dec 9, 2021 · 1 comment

Comments

@maxim-kukushkin
Copy link

maxim-kukushkin commented Dec 9, 2021

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

@maxim-kukushkin
Copy link
Author

A pull request has been raised to add this functionality: #95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant