Add `--version` handler to cli (#7150)

This commit is contained in:
Jesse Hills 2024-07-29 13:13:09 +12:00 committed by GitHub
parent 39c0019534
commit adfec578cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -747,7 +747,14 @@ def parse_args(argv):
) )
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=f"ESPHome v{const.__version__}", parents=[options_parser] description=f"ESPHome {const.__version__}", parents=[options_parser]
)
parser.add_argument(
"--version",
action="version",
version=f"Version: {const.__version__}",
help="Print the ESPHome version and exit.",
) )
mqtt_options = argparse.ArgumentParser(add_help=False) mqtt_options = argparse.ArgumentParser(add_help=False)