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

Arguments to control output #5

Open
johnny2k opened this issue Mar 30, 2017 · 4 comments
Open

Arguments to control output #5

johnny2k opened this issue Mar 30, 2017 · 4 comments

Comments

@johnny2k
Copy link

It would be nice if the output could be controlled by using options.

The worker number and timestamp either contain data I don't need or are already provided by the data being output from my other process. These could be "off' by default and enabled with options or "on" by default and disabled with options.

It might also be nice to have an argument that accepts a keyword to act as a filter. Grepping is so easy that maybe it wouldn't be worth the effort but then the nice colorized output is lost.

@fd0
Copy link
Owner

fd0 commented Apr 10, 2017

Hm, can you elaborate on the filter bit? Or maybe write up a quick example? I'm not sure I understand what you're trying to accomplish with that.

fd0 added a commit that referenced this issue Apr 10, 2017
@fd0
Copy link
Owner

fd0 commented Apr 10, 2017

I've added options to disable printing the job id, job name and timestamp (individually).

@johnny2k
Copy link
Author

I just pulled from master to check for updates and noticed the new options. Works perfectly so far!

Hm, can you elaborate on the filter bit? Or maybe write up a quick example? I'm not sure I understand what you're trying to accomplish with that.

The idea here would be that I could specify a string that would be required in the message. Any message not containing that string would not be printed.

When using grep to perform this action it causes the nice-looking, color output to change. The string I'm grepping for is the only text that is then in a separate color.

I really like the color output in machma and it would be nice to retain that when filtering out messages I'm not interested in. There could be another way to do this and I just need to find it.

@fd0
Copy link
Owner

fd0 commented Apr 11, 2017

There is a way, but it involves a bit of shell trickery: Say you're running the ping example command from the README:

$ cat /tmp/ip-address-list | machma -p 2 -- ping -c 2 -q {}

If you're only interested in errors and all lines sent on stdout with the word statistics in it, you can call machma as follows:

$ cat /tmp/ip-address-list | machma -p 2 -- sh -c 'ping -c 2 -q {} | grep statistics'

Please be aware that this may hide the exit code of the original program...

I'll think about whether it's worth it to add a filter function. The primary purpose of machma is to be simple :)

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

No branches or pull requests

2 participants