ulif/diceware

Whitespace values in diceware.ini file

Closed this issue · 4 comments

This isn't really a bug, but I want to mention it anyway, just to make sure.

If my diceware.ini file contains the following:

[diceware]
delimiter = " "
caps = off

an example output from the diceware -n 2 command is as follows:

rowdy" "aubrey

That is, the delimiter is being read literally as " " from the .ini file. Thus, there is no way (that I am aware of) to set space as your default delimiter using the ini file.

One way to fix this (if it is indeed an issue) is to add a strip('"') to line 85 in the config.py file in the get_config_dict function, as mentioned in this answer. That will strip out all instances of " from the ini file. This may or may not be a good thing.

ulif commented

Hey @dwcoder , yes, that's a shortcoming of standard libs ConfigParser / configparser I guess.

Generally, I would not oppose to strip quote symbols from string values. There will hardly be many users with literally "something-so-weird" as delimiter.

We should, however, take care to support stripping both, " as well as '.

That would make a nice little improvement with low user impact.

ulif commented

@dwcoder, I took the liberty to rename the issue. Mentioning spaces might describe more concise what the problem is. I hope you do not mind!

@ulif yeah, good idea with renaming the issue.

I will add the stripping function (and unit tests) and submit a pull request when I am done.

ulif commented

@dwcoder great, thanks a lot!