tazel
A build system for C, C++, Objective-C, Objective-C++ and Zig, with C# project files.
Clonegit clone https://git.progmasoft.com/tazel
Add Oh My Zsh and Fisher shell completion plugin support
- Commit
0a1b4b37844d23e467ad640aab46beafd6fd0c18- Author
- Leitwolf11 ·
- Parents
859480c29d5c
Changes
CHANGELOG.md | 3 ++- completions/tazel.fish | 7 +++++++ docs/commands.md | 31 +++++++++++++++++++++++++++++++ tazel.plugin.zsh | 21 +++++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 517773e..b7de3e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ - `tazel explain <code>` now supports `--short` (brief one-line summary) alongside the medium default and `--long` (full). - `tazel shell-completion bash|zsh|fish|powershell` emits shell completion scripts to standard output without requiring a - module (PowerShell requires 5.1 or later; e.g. `source <(tazel shell-completion zsh)`). + module (PowerShell requires 5.1 or later; e.g. `source <(tazel shell-completion zsh)`), with built-in Oh My Zsh + (`tazel.plugin.zsh`) and Fisher (`completions/tazel.fish`) plugin support. - `tazel help [command]` now supports `--short` (brief) alongside the medium default and `--long` (full). - `tazel license [--output|-o text|md|markdown|rst]` prints Tazel's MIT license, the Progmasoft Patent Grant 1.1, and the licenses of the libraries Tazel ships with to standard output. diff --git a/completions/tazel.fish b/completions/tazel.fish new file mode 100644 index 0000000..e99d005 --- /dev/null +++ b/completions/tazel.fish @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: MIT +# Fisher / Fish completion plugin for Tazel. + +if command -sq tazel + tazel shell-completion fish | source +end diff --git a/docs/commands.md b/docs/commands.md index 9c9f53c..a1b4763 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -26,6 +26,37 @@ | `tazel license [--output\|-o text\|md\|markdown\|rst]` | prints Tazel's MIT license, the Progmasoft Patent Grant 1.1, and the licenses of shipped libraries to stdout | | `tazel shell-completion bash\|zsh\|fish\|powershell` | prints a shell completion script to stdout (PowerShell requires 5.1 or later; e.g. `source <(tazel shell-completion zsh)`) | +## Shell completion + +`tazel shell-completion` writes a completion script to standard output and works outside any module. + +```sh +# Bash +source <(tazel shell-completion bash) + +# Zsh +source <(tazel shell-completion zsh) + +# Fish +tazel shell-completion fish | source +``` + +```powershell +# PowerShell 5.1 or later +tazel shell-completion powershell | Out-String | Invoke-Expression +``` + +Plugin managers are supported directly from this repository: + +- **Oh My Zsh:** clone into `$ZSH_CUSTOM/plugins/tazel` and add `tazel` to `plugins=(...)` in `~/.zshrc`: + ```sh + git clone https://github.com/Progmasoft/tazel.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/tazel" + ``` +- **Fisher (Fish):** + ```fish + fisher install Progmasoft/tazel + ``` + ## Options Long options take their value after whitespace, `=` or `:`: `--platform linux-aarch64`, `--platform=linux-aarch64`, diff --git a/tazel.plugin.zsh b/tazel.plugin.zsh new file mode 100644 index 0000000..3027fc2 --- /dev/null +++ b/tazel.plugin.zsh @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: MIT +# Oh My Zsh (and Zsh plugin manager) plugin for Tazel. + +if (( ! $+commands[tazel] )); then + return +fi + +if [[ -n "${ZSH_CACHE_DIR:-}" && -w "$ZSH_CACHE_DIR" ]]; then + mkdir -p "$ZSH_CACHE_DIR/completions" + if [[ ! -f "$ZSH_CACHE_DIR/completions/_tazel" || "$commands[tazel]" -nt "$ZSH_CACHE_DIR/completions/_tazel" ]]; then + tazel shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_tazel" + fi + fpath=("$ZSH_CACHE_DIR/completions" $fpath) + autoload -Uz _tazel + if (( $+functions[compdef] )); then + compdef _tazel tazel + fi +else + source <(tazel shell-completion zsh) +fi