From 600d1847c8459ea46cbbf09bb91093b3e7c1061d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 14 Oct 2023 22:21:25 +0200 Subject: [PATCH] Updated autocompletion docs (Fixes #193) --- docs/common_options.md | 1 + docs/installation.md | 61 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/docs/common_options.md b/docs/common_options.md index e2e30283..f1483374 100644 --- a/docs/common_options.md +++ b/docs/common_options.md @@ -3,6 +3,7 @@ * [Overall configuration file structure](#overall-configuration-file-structure) +* [Diagram titles](#diagram-titles) * [Translation unit glob patterns](#translation-unit-glob-patterns) * [Custom directives](#custom-directives) * [Adding debug information in the generated diagrams](#adding-debug-information-in-the-generated-diagrams) diff --git a/docs/installation.md b/docs/installation.md index 715f0062..8e5d7eca 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -12,6 +12,9 @@ * [macos](#macos) * [Windows](#windows-1) * [Visual Studio native build](#visual-studio-native-build) +* [Shell autocompletion scripts](#shell-autocompletion-scripts) + * [Bash](#bash) + * [Zsh](#zsh) @@ -171,4 +174,60 @@ Finally, remove the temporary build directory: ```bash rm -r C:\clang-uml-tmp -``` \ No newline at end of file +``` + +### Shell autocompletion scripts +For `Linux` and `macos`, Bash and Zsh autocomplete scripts are available, and +if `clang-uml` is installed from a distribution package they should work +out of the box. When installing `clang-uml` from sources the files need to be +installed manually. The completion scripts are available in directory: +* [`packaging/autocomplete`](./packaging/autocomplete) + +#### Bash +The `clang-uml.bash-completion` script can be either directly loaded to the +current Bash session using: + +```shell +source clang-uml.bash-completion +``` + +or the script can be copied to the `/etc/bash_completion.d` on Linux or +to `/usr/local/etc/bash_completion.d` on `macos` with `Homebrew`. + +```shell +sudo cp clang-uml.bash-completion /etc/bash_completion.d/clang-uml +``` + +Make sure autocompletion is enabled in your `~/.bashrc` or `~/.bash_profile`: + +```shell +if [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi +``` + +On OSX you might need to install `bash-completion` using Homebrew: +```shell +brew install bash-completion +``` +Make sure to the following lines are uncommented in the `~/.bashrc`: + +```shell +if [ -f $(brew --prefix)/etc/bash_completion ]; then + . $(brew --prefix)/etc/bash_completion +fi +``` + +#### Zsh +In Zsh, the `_clang-uml` Zsh completion file must be copied to one of the +folders under `$FPATH` variable, and the Zsh terminal should be reopened. + +For testing, `_clang-uml` completion function can be updated without +restarting Zsh: + +```shell +# Copy _clang-uml somewhere under $FPATH +$ unfunction _clang-uml +$ autoload -U _clang-uml +``` +