From 0dc6228a59dc88f32140211dac730122dca1ffae Mon Sep 17 00:00:00 2001 From: Nim Date: Tue, 14 Jan 2025 12:04:07 +0100 Subject: [PATCH] Add command completion docs (#410) (#597) Co-authored-by: Rory Flynn <75283103+roaree@users.noreply.github.com> --- docs/command_completion.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/command_completion.md diff --git a/docs/command_completion.md b/docs/command_completion.md new file mode 100644 index 00000000..643dea3c --- /dev/null +++ b/docs/command_completion.md @@ -0,0 +1,37 @@ +# Command Completion + +MVT utilizes the [Click](https://click.palletsprojects.com/en/stable/) library for creating its command line interface. + +Click provides tab completion support for Bash (version 4.4 and up), Zsh, and Fish. + +To enable it, you need to manually register a special function with your shell, which varies depending on the shell you are using. + +The following describes how to generate the command completion scripts and add them to your shell configuration. + +`You will need to start a new shell for the changes to take effect.` + +### For Bash + +```bash +# Generates bash completion scripts +echo "$(_MVT_IOS_COMPLETE=bash_source mvt-ios)" > ~/.mvt-ios-complete.bash && +echo "$(_MVT_ANDROID_COMPLETE=bash_source mvt-android)" > ~/.mvt-android-complete.bash + +# Sources the scripts in ~/.bashrc. +. ~/.mvt-ios-complete.bash && . ~/.mvt-android-complete.bash +``` + +### For Zsh + +```bash +# Generates zsh completion scripts +echo "$(_MVT_IOS_COMPLETE=zsh_source mvt-ios)" > ~/.mvt-ios-complete.zsh && +echo "$(_MVT_ANDROID_COMPLETE=zsh_source mvt-android)" > ~/.mvt-android-complete.zsh + +# Sources the scripts in ~/.zshrc. +. ~/.mvt-ios-complete.zsh && . ~/.mvt-android-complete.zsh +``` + +For more information, visit the official [Click Docs](https://click.palletsprojects.com/en/stable/shell-completion/#enabling-completion). + +