From f3c93e0302b3d29d57a803df2fc227caa8bba554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Battrel?= Date: Mon, 18 Sep 2023 19:10:05 +0200 Subject: [PATCH] Documentation: Update shell completion doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove OS specific instructions, instructions depend on the shell and are the same across OS; - Add fish shell to the documentation. Signed-off-by: Théo Battrel --- doc/develop/west/install.rst | 65 ++++++++++++++++++-------------- doc/develop/west/zephyr-cmds.rst | 1 + 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/doc/develop/west/install.rst b/doc/develop/west/install.rst index e9f877cbe3f..5ac0f6efaa4 100644 --- a/doc/develop/west/install.rst +++ b/doc/develop/west/install.rst @@ -48,50 +48,59 @@ APIs directly. See :ref:`west-apis` for details. Enabling shell completion ************************* -West currently supports shell completion in the following combinations of -platform and shell: +West currently supports shell completion in the following shells: -* Linux: bash -* macOS: bash -* Windows: not available +* bash +* zsh +* fish In order to enable shell completion, you will need to obtain the corresponding -completion script and have it sourced every time you enter a new shell session. +completion script and have it sourced. +Using the completion scripts: -To obtain the completion script you can use the ``west completion`` command:: +.. tabs:: - cd /path/to/zephyr/ - west completion bash > ~/west-completion.bash + .. group-tab:: bash -.. note:: + *One-time setup*: - Remember to update your local copy of the completion script using ``west - completion`` when you update Zephyr. + .. code-block:: bash -Next, you need to import :file:`west-completion.bash` into your bash shell. + source <(west completion bash) -On Linux, you have the following options: + *Permanent setup*: -* Copy :file:`west-completion.bash` to :file:`/etc/bash_completion.d/`. -* Copy :file:`west-completion.bash` to - :file:`/usr/share/bash-completion/completions/`. -* Copy :file:`west-completion.bash` to a local folder and source it from your - :file:`~/.bashrc`. + .. code-block:: bash -On macOS, you have the following options: + west completion bash > ~/west-completion.bash; echo "source ~/west-completion.bash" >> ~/.bashrc -* Copy :file:`west-completion.bash` to a local folder and source it from your - :file:`~/.bash_profile` -* Install the ``bash-completion`` package with ``brew``:: + .. group-tab:: zsh - brew install bash-completion + *One-time setup*: - then source the main bash completion script in your :file:`~/.bash_profile`:: + .. code-block:: zsh - source /usr/local/etc/profile.d/bash_completion.sh + source <(west completion zsh) - and finally copy :file:`west-completion.bash` to - :file:`/usr/local/etc/bash_completion.d/`. + *Permanent setup*: + + .. code-block:: zsh + + west completion zsh > "${fpath[1]}/_west" + + .. group-tab:: fish + + *One-time setup*: + + .. code-block:: fish + + west completion fish | source + + *Permanent setup*: + + .. code-block:: fish + + west completion fish > $HOME/.config/fish/completions/west.fish .. _PyPI: https://pypi.org/project/west/ diff --git a/doc/develop/west/zephyr-cmds.rst b/doc/develop/west/zephyr-cmds.rst index f6b2322e6a4..6037cb422b2 100644 --- a/doc/develop/west/zephyr-cmds.rst +++ b/doc/develop/west/zephyr-cmds.rst @@ -39,6 +39,7 @@ It currently supports the following shells: - bash - zsh +- fish Additional instructions are available in the command's help::