dispass/dispass — pull request #19 by ryuslash (2013-05-25 14:17:37+00:00)
Title: Allow each option to be overridden individually

# The problem:

I have in my labelfile:

test algorithm=dispass2

I call dispass:

# dispass generate -o test
Password:
test Mzg2ZGFiYjIxZDFhMjFiMjRkNjUyNW

All is well. Then I try:

# dispass generate -o -l 29 test
Password:
test NjIzYzkyZDhjM2U4MGE2OTYzNTk5Z

Oops! that should have produced:

test Mzg2ZGFiYjIxZDFhMjFiMjRkNjUyN

both cases used the password `testtest`.

# The cause:

In the `generate.py` file there is a local override switch which gets activated whenever one of the options is specified on the command line, in this case the `-l` switch. This causes the settings in the labelfile to be completely ignored and the defaults to be used and overridden instead.

# The solution:

Instead of checking whether an override should happen, assume that when the user specifies an option on the command line they will only want that option to be overridden and allow it to override either the settings from the labelfile or the defaults where applicable.