short args should be parsed when there is no space after
for example
@main
def ooo(@arg(short = 'j') concurrency: Int=1, vals: Leftover[String]): Unit = {
}
should allow -j16 as -j 16.
currently -j16 goes to leftover
How would you distinguish between this and the other kind of short args that can be chained together, e.g. tar -xzvf? Perhaps we'd need a configuration flag or something the same way we have allowPositional=true?
In the OP example -j16, after detecting the -j option, we could try to find an option matching -1, and fall back to parsing the rest string ("16") as argument, when appropriate. We should provide an option to disable this parsing behavior though.
How would you distinguish between this and the other kind of short args that can be chained together, e.g.
tar -xzvf? Perhaps we'd need a configuration flag or something the same way we haveallowPositional=true?
It's a good question. I looked at two standard programs that do similar things. git log -Stest is valid, so short flags arguments work without a space, but git log -gt is not, so it doesn't allow combining short flags at all.
On the other hand, grep supports both:
$ echo | grep -iwftest test
grep: test: No such file or directory
So I guess what grep does is that short flags that take an argument (I would imagine even an optional one) terminate parsing for more short flags. So an argument-less short flag can be followed by another short flag letter of any type, or whitespace.
In tar you can give tar xfz <file> where <file> is the actual argument to f.
tar is very nonstandard and the subject of plenty of internet commentary
Sorry I think I misunderstood your point.
A space should be allowed, but at least when the flag is on its own it should be optional.