As you've already noticed, it's pain to maintain command line arguments as nested if statements. Usually CLI tools approach argument parsing problem more decleratively, by defining all possible command arguments and leaving the parsing up to dedicated argument parsing library.
Python comes with one called argparse. Take a look at the examples in the documentation and you'll see the benefits of this sort of approach: docs.python.org/3/library/argparse...
Besides specifying arguments like this avoids the issue of complicated merges!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As you've already noticed, it's pain to maintain command line arguments as nested if statements. Usually CLI tools approach argument parsing problem more decleratively, by defining all possible command arguments and leaving the parsing up to dedicated argument parsing library.
Python comes with one called
argparse
. Take a look at the examples in the documentation and you'll see the benefits of this sort of approach: docs.python.org/3/library/argparse...Besides specifying arguments like this avoids the issue of complicated merges!