tf2classic / TF2CDownloader

Cross-platform utility for automatically downloading and installing TF2 Classic
GNU General Public License v3.0
48 stars 13 forks source link

Fixed script mode so it can update the game again #28

Closed MaartenS11 closed 1 year ago

MaartenS11 commented 2 years ago

Small pr that fixes a few bugs with the downloader. Things such as update_version_file being used with an argument that doesn't exist, error messages not being displayed because they are part of a question and the default option for updating being None causing script mode to never actually update the game.

To keep the old default behaviour I added an override option for script mode that allows us to specify the option that we would probably want to use when in script mode. This is especially useful when the default is None.

I also took a look at message_yes_no since the types are a little messed up. Default is expected to be a string but we also return default if we are in script mode but the return value is actually a boolean so there are some wrong assumptions here. I added some type hints to make sure we don't get confused in the future, the real value we use as default these days are booleans but the code wasn't really adjusted for that yet.