fd0 / machma

Easy parallel execution of commands with live feedback

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arguments to control output

johnny2k opened this issue · comments

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.

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.

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

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.

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 :)