Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move constants to dot config file #5

Open
metbril opened this issue Nov 16, 2018 · 4 comments
Open

Move constants to dot config file #5

metbril opened this issue Nov 16, 2018 · 4 comments

Comments

@metbril
Copy link

metbril commented Nov 16, 2018

Suggestion.

The code has some constants Iike separators and ignored words that are hardcoded. Since I used pip to install, it is hard to customize this. My suggestion would be to move these constants to a hidden config file in $HOME, like $HOME/.appendfilename or $HOME/.config/appendfilename.

https://unix.stackexchange.com/questions/68721/where-should-user-configuration-files-go

@novoid
Copy link
Owner

novoid commented Nov 18, 2018

Good point and I will have to think about it.

My initial thoughts:

I do hesitate putting FILENAME_TAG_SEPARATOR, BETWEEN_TAG_SEPARATOR, or TEXT_SEPARATOR into a user config file. Since appendfilename is embedded in workflows with other tools, I would never support different values for those variables.

For FILENAME_COMPONENT_LOWERCASE_BLACKLIST and INITIAL_CONTROLLED_VOCABULARY it is a different story though. Do you really want to modify them? I honestly did forget that I do have such variables myself in the first place ...

@metbril
Copy link
Author

metbril commented Nov 19, 2018

Well, for FILENAME_COMPONENT_LOWERCASE_BLACKLIST you are using German phrases. My main language is Dutch, but I also use English a lot, so to be able to blacklist in another language a configurable list would be nice.

I'm not sure what I would use INITIAL_CONTROLLED_VOCABULARY for, but these words seem specific to your personal use cases. Since the tool is in pip, I would suggest making it generic with some sensible defaults?

Don't you think using the separators in a config file (always) is the owner/user's responsibility? Your defaults make sense, and any other tools should (imho) also support configured separators.

@novoid
Copy link
Owner

novoid commented Nov 19, 2018

Hi,

As far as I remember, INITIAL_CONTROLLED_VOCABULARY was necessary for unit testing but I'd have to look into it to confirm this. IMHO it's not necessary for a user to overwrite/modify this since I've implemented the .filetags approach which allows even more advanced workflows.

ad modifying the separator string: you're right that it is the responsibility of the user. However, when I do see a config possibility as a user, I should be able to assume that any valid setting is supported by the tool. And this assumption I need to avoid.

The likelihood that something gets broken among appendfilename, guessfilename, filetags, and much more tools because of changing the separator string is very high. Therefore, I consider FILENAME_TAG_SEPARATOR, BETWEEN_TAG_SEPARATOR, and TEXT_SEPARATOR as hard-coded even when I decided to put them into constants.

For FILENAME_COMPONENT_LOWERCASE_BLACKLIST and INITIAL_CONTROLLED_VOCABULARY I have to take a deeper look and think about it. So far, there are no clear use-cases to me because I don't think that I myself still need/use them. Maybe they get removed altogether.

@novoid
Copy link
Owner

novoid commented Sep 12, 2020

This could also address #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants