Click already has an builtin function to implement the version flag for us. https://click.palletsprojects.com/en/7.x/api/#click.version_option