Skip to content

Commit

Permalink
Add docs for command completion (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-a committed Dec 22, 2024
1 parent e546f1e commit f878db0
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docs/command_completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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 register a special function with your shell, which varies depending on the shell you are using.

`You need to start a new shell in order for the changes to be loaded.`

### For Bash

```bash
# Get the completion scripts
curl --tlsv1.3 -O https://github.com/mvt-project/mvt/tree/main/src/mvt/shell_completion/.mvt-{ios,android}-complete.bash

# Source the file in ~/.bashrc.
. .mvt-android-complete.bash && . .mvt-ios-complete.bash
```

### For Zsh

```bash
# Get the completion scripts
curl --tlsv1.3 -O https://github.com/mvt-project/mvt/tree/main/src/mvt/shell_completion/.mvt-{ios,android}-complete.zsh

# Source the file in ~/.zshrc.
. .mvt-android-complete.zsh && . .mvt-ios-complete.zsh
```

## Generate Scripts locally

In case you prefer not to download the command completion scripts from the MVT Project, you can generate your own scripts locally.

### For Bash

```bash
echo "$(_MVT_IOS_COMPLETE=bash_source mvt-ios)" > ~/.mvt-ios-complete.bash &&
echo "$(_MVT_ANDROID_COMPLETE=bash_source mvt-android)" > ~/.mvt-android-complete.bash
```

### For Zsh
```bash
echo "$(_MVT_IOS_COMPLETE=zsh_source mvt-ios)" > ~/.mvt-ios-complete.zsh &&
echo "$(_MVT_ANDROID_COMPLETE=zsh_source mvt-android)" > ~/.mvt-android-complete.zsh
```

You will then need to source the files in your shell configuration file and restart it for the changes to be loaded.


For more information, visit the official [Click Docs](https://click.palletsprojects.com/en/stable/shell-completion/#enabling-completion).


0 comments on commit f878db0

Please sign in to comment.