Georg Wrede wrote:
Sometimes I need to have a command line UI in a program. Such programs
usually have 5 to 10 commands, with their parameters. One command per line.
So far I have tested and split the command line with regular
expressions, because using a parser generator has felt like shooting
mosquitos with a shotgun.
What would your strategy be?
If it's 5 or 10, you can get by with ad-hoc. But if you find yourself
repeatedly fixing bugs in the parsing, it's time to consider a more
principled approach.