Should I check for dependencies before or after parsing arguments? [on hold]
My command-line program requires that the user install a few other programs from a package manager - assume that I can't declare dependencies on them and have them resolved automatically. If they aren't installed, it terminates with status code 1 and prints a message telling the user how to install the other programs.
I am wondering if I should do this before or after parsing arguments. The difference only matters in the case of --help
or invalid arguments: if I check before, it will print my error message. If I check after, it will print the help or invalid argument error (Python argparse
FWIW). If the user puts in actual arguments, it would then proceed to the dependency error message.
Which is better?