Skip to content

Commit

Permalink
Update help output (fixes #173)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabaff committed Feb 14, 2019
1 parent 8bf2b3b commit 5ee4585
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions homeassistant_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def get_command(


def _default_token() -> Optional[str]:
"""Handle the token provided as env variable."""
return os.environ.get('HASS_TOKEN', os.environ.get('HASSIO_TOKEN', None))


Expand All @@ -105,21 +106,30 @@ def _default_token() -> Optional[str]:
@click.option(
'--server',
'-s',
help='The server URL or `auto` for automatic detection',
help=(
'The server URL or `auto` for automatic detection. Can also be set '
'with he environment variable HASS_SERVER.'
),
default="auto",
show_default=True,
envvar='HASS_SERVER',
)
@click.option(
'--token',
default=_default_token,
help='The Bearer token for Home Assistant instance.',
help=(
'The Bearer token for Home Assistant instance. Can also be set with '
'the environment variable HASS_TOKEN.'
),
envvar='HASS_TOKEN',
)
@click.option(
'--password',
default=None, # type: ignore
help='The API password for Home Assistant instance.',
default=None,
help=(
'The API password for Home Assistant instance. Can also be set with '
'the environment variable HASS_PASSWORD.'
),
envvar='HASS_PASSWORD',
)
@click.option(
Expand Down Expand Up @@ -212,7 +222,7 @@ def cli(
no_headers: bool,
table_format: str,
sort_by: Optional[str],
):
) -> None:
"""Command line interface for Home Assistant."""
ctx.verbose = verbose
ctx.server = server
Expand Down

0 comments on commit 5ee4585

Please sign in to comment.