From d6f3feb2d7cc570cfde6ff8e4c389df212224f85 Mon Sep 17 00:00:00 2001 From: Shirshanka Das Date: Thu, 19 Jan 2023 09:04:44 -0800 Subject: [PATCH] docs(datahub-lite): small improvement for zsh tab completion (#7085) --- docs/datahub_lite.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/datahub_lite.md b/docs/datahub_lite.md index b52da68257..3b82448492 100644 --- a/docs/datahub_lite.md +++ b/docs/datahub_lite.md @@ -545,9 +545,9 @@ DataHub Lite is a very new project. Do not use it for production use-cases. The ### Tab Completion Using the datahub lite commands like `ls` or `get` is much more pleasant when you have tab completion enabled on your shell. Tab completion is supported on the command line through the [Click Shell completion](https://click.palletsprojects.com/en/8.1.x/shell-completion/) module. -To set up shell completion for your shell, follow the instructions below: +To set up shell completion for your shell, follow the instructions below based on your shell variant: -#### Option 1 (inline eval) +#### Option 1: Inline eval (easy, less performant) @@ -570,7 +570,7 @@ eval "$(_DATAHUB_COMPLETE=bash_source datahub)" -#### Option 2 (external completion script) +#### Option 2: External completion script (recommended, better performance) Using eval means that the command is invoked and evaluated every time a shell is started, which can delay shell responsiveness. To speed it up, write the generated script to a file, then source that. @@ -580,7 +580,8 @@ Using eval means that the command is invoked and evaluated every time a shell is Save the script somewhere. ```shell -_DATAHUB_COMPLETE=zsh_source datahub > ~/.datahub-complete.zsh +# the additional sed patches completion to be path oriented and not add spaces between each completed token +_DATAHUB_COMPLETE=zsh_source datahub | sed 's;compadd;compadd -S /;' > ~/.datahub-complete.zsh ``` Source the file in ~/.zshrc.