mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
CLI show version better (#581)
Fixes https://github.com/esphome/feature-requests/issues/256
This commit is contained in:
parent
3012fee013
commit
2b186fdb0d
1 changed files with 6 additions and 2 deletions
|
@ -370,13 +370,13 @@ POST_CONFIG_ACTIONS = {
|
||||||
|
|
||||||
|
|
||||||
def parse_args(argv):
|
def parse_args(argv):
|
||||||
parser = argparse.ArgumentParser(prog='esphome')
|
parser = argparse.ArgumentParser(description='ESPHome v{}'.format(const.__version__))
|
||||||
parser.add_argument('-v', '--verbose', help="Enable verbose esphome logs.",
|
parser.add_argument('-v', '--verbose', help="Enable verbose esphome logs.",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('-q', '--quiet', help="Disable all esphome logs.",
|
parser.add_argument('-q', '--quiet', help="Disable all esphome logs.",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('--dashboard', help=argparse.SUPPRESS, action='store_true')
|
parser.add_argument('--dashboard', help=argparse.SUPPRESS, action='store_true')
|
||||||
parser.add_argument('configuration', help='Your YAML configuration file.')
|
parser.add_argument('configuration', help='Your YAML configuration file.', nargs='?')
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(help='Commands', dest='command')
|
subparsers = parser.add_subparsers(help='Commands', dest='command')
|
||||||
subparsers.required = True
|
subparsers.required = True
|
||||||
|
@ -454,6 +454,10 @@ def run_esphome(argv):
|
||||||
CORE.dashboard = args.dashboard
|
CORE.dashboard = args.dashboard
|
||||||
|
|
||||||
setup_log(args.verbose, args.quiet)
|
setup_log(args.verbose, args.quiet)
|
||||||
|
if args.command != 'version' and args.configuration is None:
|
||||||
|
_LOGGER.error("Missing configuration parameter, see esphome --help.")
|
||||||
|
return 1
|
||||||
|
|
||||||
if args.command in PRE_CONFIG_ACTIONS:
|
if args.command in PRE_CONFIG_ACTIONS:
|
||||||
try:
|
try:
|
||||||
return PRE_CONFIG_ACTIONS[args.command](args)
|
return PRE_CONFIG_ACTIONS[args.command](args)
|
||||||
|
|
Loading…
Reference in a new issue