Jvanrhijn / polybar-spotify

🎶 Spotify artist and song module for Polybar
MIT License
586 stars 57 forks source link

Refactor command line argument parsing #19

Open FMeinicke opened 4 years ago

FMeinicke commented 4 years ago

When I did my last pull request I noticed some weird usage of argparse's `add_argument' kwargs.

Parsing of command-line arguments is now done in a separate function which returns the parsed arguments. Additionally, most of the add_argument calls are now using the correct way to display help about what the argument is doing. Previously the metavar kwarg was used and not the help kwarg. I added some additional information where I thought the current help message was not enough (e.g. for the play_pause indicator it is really helpful to know that the argument expects a command separated string where 'play' comes first and 'pause' comes second.) Also, I added default values where possible to remove the kind of boilerplate code that checked if the command line argument is present and if so replaced a default value. This is now handled by argparse using the default kwarg.