diff options
| author | Gavin Mak <gavinmak@google.com> | 2026-05-08 19:39:58 +0000 |
|---|---|---|
| committer | gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-05-08 17:41:44 -0700 |
| commit | a98e4221139765f4475d7c0a524b59c688077e75 (patch) | |
| tree | 73284468dfa2078d18020691be3191639aa5af9f | |
| parent | 5d8585012f384d1e2566f9c0b7ad7c0efcc5edd2 (diff) | |
| download | git-repo-main.tar.gz | |
completion: document installation and usage in READMEmain
Add a "Shell Completion" section to README.md to document how to install
and use `completion.bash` and `completion.zsh`.
Change-Id: Ibf6c81043af6c24d45ea2dc6a6caa26d98ab7374
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/581261
Tested-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
| -rw-r--r-- | README.md | 37 |
1 files changed, 37 insertions, 0 deletions
| @@ -49,6 +49,43 @@ $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo | |||
| 49 | $ chmod a+rx ~/.bin/repo | 49 | $ chmod a+rx ~/.bin/repo |
| 50 | ``` | 50 | ``` |
| 51 | 51 | ||
| 52 | ## Shell Completion | ||
| 53 | |||
| 54 | Repo includes completion scripts for Bash and Zsh. | ||
| 55 | |||
| 56 | ### Bash | ||
| 57 | |||
| 58 | To enable completion in Bash, source `completion.bash` in your `~/.bashrc`: | ||
| 59 | |||
| 60 | ```sh | ||
| 61 | source /path/to/git-repo/completion.bash | ||
| 62 | ``` | ||
| 63 | |||
| 64 | ### Zsh | ||
| 65 | |||
| 66 | To enable completion in Zsh, you can either: | ||
| 67 | |||
| 68 | 1. Copy or symlink `completion.zsh` to a file named `_repo` in a directory in your `$fpath`: | ||
| 69 | ```sh | ||
| 70 | mkdir -p ~/.zsh/completion | ||
| 71 | # You can copy the file: | ||
| 72 | cp /path/to/git-repo/completion.zsh ~/.zsh/completion/_repo | ||
| 73 | # Or symlink it: | ||
| 74 | ln -s /path/to/git-repo/completion.zsh ~/.zsh/completion/_repo | ||
| 75 | ``` | ||
| 76 | Then add that directory to your `fpath` in `~/.zshrc` before `compinit`: | ||
| 77 | ```zsh | ||
| 78 | fpath=(~/.zsh/completion $fpath) | ||
| 79 | autoload -Uz compinit | ||
| 80 | compinit | ||
| 81 | ``` | ||
| 82 | |||
| 83 | 2. Or source the file directly and call `compdef` in your `~/.zshrc`: | ||
| 84 | ```zsh | ||
| 85 | source /path/to/git-repo/completion.zsh | ||
| 86 | compdef _repo repo | ||
| 87 | ``` | ||
| 88 | |||
| 52 | 89 | ||
| 53 | [new-bug]: https://issues.gerritcodereview.com/issues/new?component=1370071 | 90 | [new-bug]: https://issues.gerritcodereview.com/issues/new?component=1370071 |
| 54 | [issue tracker]: https://issues.gerritcodereview.com/issues?q=is:open%20componentid:1370071 | 91 | [issue tracker]: https://issues.gerritcodereview.com/issues?q=is:open%20componentid:1370071 |
