mmstick/parallel

parallel complains if no arguments are passed

ChrisJefferson opened this issue · 4 comments

Parallel complains if no arguments are passed. However, it should be fine to write something like:

echo 'echo Hello' | parallel

If I just pick an argument to add (like -n or -q or -v) then the code runs fine as I expect.

Pull requests are welcome, as I'm busy with other matters at the moment. It should be a matter of just checking if any inputs were passed to stdin and setting the relevent boolean flag in the argument parsing module.

Will look. Unfortunately it's a little more complicated, as stdin is always connected. We need to check if stdin is a terminal (in which case let's require some arguments), or not (in which case we are fine).

Will look into how to detect if stdin is a terminal in rust.

It really shouldn't matter. It's only read from during argument parsing if no arguments were passed, although there's a check that ensures that at least one argument was given for the command.

I just pushed a commit that fixes this issue. All I did was merely added a check to see if any arguments were passed, and if none are passed it skips ahead to reading from stdin, and if after attempting to read from stdin that there are still no arguments, then it will error, otherwise continue with stdin arguments being used as commands.