| |
@@ -0,0 +1,236 @@
|
| |
+ diff --git a/README.rst b/README.rst
|
| |
+ index 27e77f3..41f13e6 100644
|
| |
+ --- a/README.rst
|
| |
+ +++ b/README.rst
|
| |
+ @@ -89,13 +89,14 @@ recommended setup ``HASS_SERVER`` and ``HASS_TOKEN`` environment variables.
|
| |
+ $ export HASS_SERVER=https://homeassistant.local:8123
|
| |
+ $ export HASS_TOKEN=<secret>
|
| |
+
|
| |
+ -Once that is enabled and you are using either ``zsh`` or ``bash`` run
|
| |
+ -the following to enable autocompletion for ``hass-cli`` commands.
|
| |
+ +Once that is enabled, run one of the following commands to enable
|
| |
+ +autocompletion for ``hass-cli`` commands.
|
| |
+
|
| |
+ .. code:: bash
|
| |
+
|
| |
+ - $ source <(hass-cli completion zsh)
|
| |
+ -
|
| |
+ + $ source <(_HASS_CLI_COMPLETE=bash_source hass-cli) # for bash
|
| |
+ + $ source <(_HASS_CLI_COMPLETE=zsh_source hass-cli) # for zsh
|
| |
+ + $ eval (_HASS_CLI_COMPLETE=fish_source hass-cli) # for fish
|
| |
+
|
| |
+ Usage
|
| |
+ =======
|
| |
+ @@ -493,7 +494,6 @@ Help
|
| |
+
|
| |
+ Commands:
|
| |
+ area Get info and operate on areas from Home Assistant...
|
| |
+ - completion Output shell completion code for the specified shell (bash or...
|
| |
+ config Get configuration from a Home Assistant instance.
|
| |
+ device Get info and operate on devices from Home Assistant...
|
| |
+ discover Discovery for the local network.
|
| |
+ diff --git a/homeassistant_cli/cli.py b/homeassistant_cli/cli.py
|
| |
+ index 9b2013a..db349dd 100644
|
| |
+ --- a/homeassistant_cli/cli.py
|
| |
+ +++ b/homeassistant_cli/cli.py
|
| |
+ @@ -198,7 +198,7 @@ def _default_token() -> Optional[str]:
|
| |
+ '--table-format',
|
| |
+ default='plain',
|
| |
+ help="Which table format to use.",
|
| |
+ - autocompletion=autocompletion.table_formats,
|
| |
+ + shell_complete=autocompletion.table_formats,
|
| |
+ )
|
| |
+ @click.option(
|
| |
+ '--sort-by',
|
| |
+ diff --git a/homeassistant_cli/plugins/area.py b/homeassistant_cli/plugins/area.py
|
| |
+ index 881a5c9..30ea0a4 100644
|
| |
+ --- a/homeassistant_cli/plugins/area.py
|
| |
+ +++ b/homeassistant_cli/plugins/area.py
|
| |
+ @@ -77,7 +77,7 @@ def create(ctx, names):
|
| |
+ 'names',
|
| |
+ nargs=-1,
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.areas, # type: ignore
|
| |
+ + shell_complete=autocompletion.areas, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def delete(ctx, names):
|
| |
+ @@ -114,7 +114,7 @@ def delete(ctx, names):
|
| |
+ @click.argument(
|
| |
+ 'oldname',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.areas, # type: ignore
|
| |
+ + shell_complete=autocompletion.areas, # type: ignore
|
| |
+ )
|
| |
+ @click.argument('newname', required=True)
|
| |
+ @pass_context
|
| |
+ diff --git a/homeassistant_cli/plugins/device.py b/homeassistant_cli/plugins/device.py
|
| |
+ index 5c03dea..eadfd78 100644
|
| |
+ --- a/homeassistant_cli/plugins/device.py
|
| |
+ +++ b/homeassistant_cli/plugins/device.py
|
| |
+ @@ -68,7 +68,7 @@ def listcmd(ctx: Configuration, devicefilter: str):
|
| |
+ @click.argument(
|
| |
+ 'area_id_or_name',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.areas, # type: ignore
|
| |
+ + shell_complete=autocompletion.areas, # type: ignore
|
| |
+ )
|
| |
+ @click.argument('names', nargs=-1, required=False)
|
| |
+ @click.option(
|
| |
+ diff --git a/homeassistant_cli/plugins/entity.py b/homeassistant_cli/plugins/entity.py
|
| |
+ index b5be2a5..52ebda4 100644
|
| |
+ --- a/homeassistant_cli/plugins/entity.py
|
| |
+ +++ b/homeassistant_cli/plugins/entity.py
|
| |
+ @@ -61,13 +61,13 @@ def listcmd(ctx: Configuration, entityfilter: str):
|
| |
+ @click.argument(
|
| |
+ 'oldid',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @click.option('--name', required=False)
|
| |
+ @click.argument(
|
| |
+ 'newid',
|
| |
+ required=False,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def rename(ctx, oldid, newid, name):
|
| |
+ diff --git a/homeassistant_cli/plugins/event.py b/homeassistant_cli/plugins/event.py
|
| |
+ index 1577a0a..15a81df 100644
|
| |
+ --- a/homeassistant_cli/plugins/event.py
|
| |
+ +++ b/homeassistant_cli/plugins/event.py
|
| |
+ @@ -25,7 +25,7 @@ def cli(ctx):
|
| |
+ @click.argument(
|
| |
+ 'event',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.events, # type: ignore
|
| |
+ + shell_complete=autocompletion.events, # type: ignore
|
| |
+ )
|
| |
+ @click.option(
|
| |
+ '--json',
|
| |
+ diff --git a/homeassistant_cli/plugins/map.py b/homeassistant_cli/plugins/map.py
|
| |
+ index e0045d6..f1b6778 100644
|
| |
+ --- a/homeassistant_cli/plugins/map.py
|
| |
+ +++ b/homeassistant_cli/plugins/map.py
|
| |
+ @@ -23,7 +23,7 @@ SERVICE = {
|
| |
+ @click.argument(
|
| |
+ 'entity',
|
| |
+ required=False,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @click.option(
|
| |
+ '--service', default='openstreetmap', type=click.Choice(SERVICE.keys())
|
| |
+ diff --git a/homeassistant_cli/plugins/raw.py b/homeassistant_cli/plugins/raw.py
|
| |
+ index 5d6fc34..46c544e 100644
|
| |
+ --- a/homeassistant_cli/plugins/raw.py
|
| |
+ +++ b/homeassistant_cli/plugins/raw.py
|
| |
+ @@ -42,7 +42,7 @@ def _report(ctx, cmd, method, response) -> None:
|
| |
+
|
| |
+ @cli.command()
|
| |
+ @click.argument(
|
| |
+ - 'method', autocompletion=autocompletion.api_methods # type: ignore
|
| |
+ + 'method', shell_complete=autocompletion.api_methods # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def get(ctx: Configuration, method):
|
| |
+ @@ -54,7 +54,7 @@ def get(ctx: Configuration, method):
|
| |
+
|
| |
+ @cli.command()
|
| |
+ @click.argument(
|
| |
+ - 'method', autocompletion=autocompletion.api_methods # type: ignore
|
| |
+ + 'method', shell_complete=autocompletion.api_methods # type: ignore
|
| |
+ )
|
| |
+ @click.option('--json')
|
| |
+ @pass_context
|
| |
+ @@ -72,7 +72,7 @@ def post(ctx: Configuration, method, json):
|
| |
+
|
| |
+ @cli.command("ws")
|
| |
+ @click.argument(
|
| |
+ - 'wstype', autocompletion=autocompletion.wsapi_methods # type: ignore
|
| |
+ + 'wstype', shell_complete=autocompletion.wsapi_methods # type: ignore
|
| |
+ )
|
| |
+ @click.option('--json')
|
| |
+ @pass_context
|
| |
+ diff --git a/homeassistant_cli/plugins/service.py b/homeassistant_cli/plugins/service.py
|
| |
+ index e762829..e1c840f 100644
|
| |
+ --- a/homeassistant_cli/plugins/service.py
|
| |
+ +++ b/homeassistant_cli/plugins/service.py
|
| |
+ @@ -80,7 +80,7 @@ def list_cmd(ctx: Configuration, servicefilter):
|
| |
+ @click.argument(
|
| |
+ 'service',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.services, # type: ignore
|
| |
+ + shell_complete=autocompletion.services, # type: ignore
|
| |
+ )
|
| |
+ @click.option(
|
| |
+ '--arguments', help="Comma separated key/value pairs to use as arguments."
|
| |
+ diff --git a/homeassistant_cli/plugins/state.py b/homeassistant_cli/plugins/state.py
|
| |
+ index 2ea1dff..05bbb1e 100644
|
| |
+ --- a/homeassistant_cli/plugins/state.py
|
| |
+ +++ b/homeassistant_cli/plugins/state.py
|
| |
+ @@ -26,7 +26,7 @@ def cli(ctx):
|
| |
+ @click.argument(
|
| |
+ 'entity',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def get(ctx: Configuration, entity):
|
| |
+ @@ -50,7 +50,7 @@ def get(ctx: Configuration, entity):
|
| |
+ @click.argument(
|
| |
+ 'entity',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def delete(ctx: Configuration, entity):
|
| |
+ @@ -95,7 +95,7 @@ def list(ctx, entityfilter):
|
| |
+ @click.argument(
|
| |
+ 'entity',
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @click.argument('newstate', required=False)
|
| |
+ @click.option(
|
| |
+ @@ -207,7 +207,7 @@ def _homeassistant_cmd(ctx: Configuration, entities, cmd, action):
|
| |
+ 'entities',
|
| |
+ nargs=-1,
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def toggle(ctx: Configuration, entities):
|
| |
+ @@ -221,7 +221,7 @@ def toggle(ctx: Configuration, entities):
|
| |
+ 'entities',
|
| |
+ nargs=-1,
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def off_cmd(ctx: Configuration, entities):
|
| |
+ @@ -235,7 +235,7 @@ def off_cmd(ctx: Configuration, entities):
|
| |
+ 'entities',
|
| |
+ nargs=-1,
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @pass_context
|
| |
+ def on_cmd(ctx: Configuration, entities):
|
| |
+ @@ -249,7 +249,7 @@ def on_cmd(ctx: Configuration, entities):
|
| |
+ 'entities',
|
| |
+ nargs=-1,
|
| |
+ required=True,
|
| |
+ - autocompletion=autocompletion.entities, # type: ignore
|
| |
+ + shell_complete=autocompletion.entities, # type: ignore
|
| |
+ )
|
| |
+ @click.option(
|
| |
+ '--since',
|
| |
This is required for the click update to 8.1.x however there are some test failures.