Is there a way to trick argparse
into accepting arbitrary numeric arguments like HEAD(1)
?
head -5 test.txt
is equivalent to
head -n 5 test.txt
My current approach is to use parse_known_args()
and then handle the remainder, but I'd wish there was something a tad more elegant.
Neither agrparse nor optparse supports this.