├── .github ├── ISSUE_TEMPLATE │ ├── bug_report_gui.yml │ ├── bug_report_tui.yml │ └── config.yml └── dependabot.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── src └── custom │ ├── _asdf │ ├── _axel │ ├── _bun │ ├── _cargo │ ├── _cargo-clippy │ ├── _cargo-fmt │ ├── _dasht │ ├── _dasht_docsets │ ├── _dasht_pattern │ ├── _dasht_query_exec │ ├── _deno │ ├── _docker │ ├── _docker-compose │ ├── _fd │ ├── _fzf │ ├── _helm │ ├── _hugo │ ├── _kubectl │ ├── _limactl │ ├── _mdbook │ ├── _pnpm │ ├── _podman │ ├── _podman-remote │ ├── _proxychains4 │ ├── _rg │ ├── _rip │ ├── _rust-analyzer │ ├── _rust-gdb │ ├── _rust-lldb │ ├── _rustc │ ├── _rustdoc │ ├── _rustfmt │ ├── _rustup │ ├── _tinymist │ ├── _tldr │ ├── _trpc-cli │ ├── _youtube-dl │ ├── _yt-dlp │ ├── npm.plugin.zsh │ ├── pip.plugin.zsh │ └── update └── zsh-completions.plugin.zsh /.github/ISSUE_TEMPLATE/bug_report_gui.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report GUI 2 | description: Choose this template if you are using a GUI client 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before reporting:_ search [existing issues](https://github.com/sainnhe/sonokai/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the FAQ in help doc. Any bug report which doesn't follow the issue template and I can't reproduce will be closed. 9 | 10 | - type: input 11 | attributes: 12 | label: "Operating system/version" 13 | placeholder: "e.g. macOS Big Sur 11.6" 14 | validations: 15 | required: true 16 | - type: input 17 | attributes: 18 | label: "GUI client/version" 19 | placeholder: "e.g. neovide 0.7.0" 20 | validations: 21 | required: true 22 | - type: textarea 23 | attributes: 24 | label: "Feature matrix" 25 | description: | 26 | - If you are using gvim, paste **ALL** the output of `vim --version` (execute this command in your terminal emulator) 27 | - If you are using a neovim GUI client, paste **ALL** the output of `:checkhealth` (execute this command in your neovim) 28 | validations: 29 | required: true 30 | - type: textarea 31 | attributes: 32 | label: "Minimal vimrc that can reproduce this bug." 33 | placeholder: | 34 | ```vim 35 | call plug#begin(fnamemodify(stdpath('data'), ':p') . 'plugins') 36 | Plug 'sainnhe/sonokai' 37 | call plug#end() 38 | 39 | set termguicolors 40 | colorscheme sonokai 41 | ``` 42 | validations: 43 | required: true 44 | - type: textarea 45 | attributes: 46 | label: "Steps to reproduce this bug using minimal vimrc" 47 | placeholder: | 48 | 1. Launch (neo)vim using minimal vimrc. 49 | 2. Execute `:edit foo.txt`. 50 | 3. Other steps. 51 | validations: 52 | required: true 53 | - type: textarea 54 | attributes: 55 | label: "Expected behavior" 56 | validations: 57 | required: true 58 | - type: textarea 59 | attributes: 60 | label: "Actual behavior" 61 | validations: 62 | required: true 63 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report_tui.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report TUI 2 | description: Choose this template if you are using (neo)vim in a terminal emulator 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before reporting:_ search [existing issues](https://github.com/sainnhe/sonokai/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the FAQ in help doc. Any bug report which doesn't follow the issue template and I can't reproduce will be closed. 9 | 10 | - type: input 11 | attributes: 12 | label: "Operating system/version" 13 | placeholder: "e.g. macOS Big Sur 11.6" 14 | validations: 15 | required: true 16 | - type: input 17 | attributes: 18 | label: "Terminal emulator/version" 19 | placeholder: "e.g. iTerm2 3.4.8" 20 | validations: 21 | required: true 22 | - type: input 23 | attributes: 24 | label: "$TERM environment variable" 25 | placeholder: "Paste the output of `echo $TERM`" 26 | validations: 27 | required: true 28 | - type: input 29 | attributes: 30 | label: "Tmux version" 31 | description: "Fill this section if you are using (neo)vim in tmux." 32 | placeholder: "Paste the output of `tmux -V`" 33 | validations: 34 | required: false 35 | - type: textarea 36 | attributes: 37 | label: "Feature matrix" 38 | description: | 39 | - If you are using vim, paste **ALL** the output of `vim --version` (execute this command in your terminal emulator) 40 | - If you are using neovim, paste **ALL** the output of `:checkhealth` (execute this command in your neovim) 41 | validations: 42 | required: true 43 | - type: textarea 44 | attributes: 45 | label: "Minimal vimrc that can reproduce this bug." 46 | placeholder: | 47 | ```vim 48 | call plug#begin(fnamemodify(stdpath('data'), ':p') . 'plugins') 49 | Plug 'sainnhe/sonokai' 50 | call plug#end() 51 | 52 | set termguicolors 53 | colorscheme sonokai 54 | ``` 55 | validations: 56 | required: true 57 | - type: textarea 58 | attributes: 59 | label: "Steps to reproduce this bug using minimal vimrc" 60 | placeholder: | 61 | 1. Launch neovim using `nvim -u mini.vim`. 62 | 2. Execute `:edit foo.txt`. 63 | 3. Other steps. 64 | validations: 65 | required: true 66 | - type: textarea 67 | attributes: 68 | label: "Expected behavior" 69 | validations: 70 | required: true 71 | - type: textarea 72 | attributes: 73 | label: "Actual behavior" 74 | validations: 75 | required: true 76 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "gitsubmodule" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "monthly" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ._zinit 2 | *.zwc 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/zsh-users.zsh-completions"] 2 | path = src/zsh-users.zsh-completions 3 | url = https://github.com/zsh-users/zsh-completions.git 4 | [submodule "src/zchee.zsh-completions"] 5 | path = src/zchee.zsh-completions 6 | url = https://github.com/zchee/zsh-completions.git 7 | [submodule "src/gradle.gradle-completion"] 8 | path = src/gradle.gradle-completion 9 | url = https://github.com/gradle/gradle-completion.git 10 | [submodule "src/spwhitt.nix-zsh-completions"] 11 | path = src/spwhitt.nix-zsh-completions 12 | url = https://github.com/spwhitt/nix-zsh-completions.git 13 | [submodule "src/custom/genhelp"] 14 | path = src/custom/genhelp 15 | url = https://github.com/RobSis/zsh-completion-generator.git 16 | [submodule "src/conda-incubator.conda-zsh-completion"] 17 | path = src/conda-incubator.conda-zsh-completion 18 | url = https://github.com/conda-incubator/conda-zsh-completion.git 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 sainnhe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## zsh-completions 2 | 3 | This project is my personal collection of zsh completion definitions, currently includes: 4 | 5 | - [zsh-users/zsh-completions](https://github.com/zsh-users/zsh-completions) 6 | - [zchee/zsh-completions](https://github.com/zchee/zsh-completions) 7 | - [gradle/gradle-completion](https://github.com/gradle/gradle-completion) 8 | - [conda-incubator/conda-zsh-completion](https://github.com/conda-incubator/conda-zsh-completion) 9 | - [spwhitt/nix-zsh-completions](https://github.com/spwhitt/nix-zsh-completions) 10 | - Some [custom](https://github.com/sainnhe/zsh-completions/tree/master/src/custom) completion definitions. 11 | 12 | ## Installation 13 | 14 | ### Via Plugin Manager 15 | 16 | Take [zinit](https://github.com/zdharma-continuum/zinit) for example: 17 | 18 | ```shell 19 | zinit ice wait'0' lucid depth=1 \ 20 | atload"autoload -Uz compinit && compinit -u" \ 21 | atpull"zinit cclear && zinit creinstall sainnhe/zsh-completions" 22 | zinit light sainnhe/zsh-completions 23 | ``` 24 | 25 | **Note:** This repository contains some submodules, please make sure your plugin manager can update them. 26 | 27 | ### Manually 28 | 29 | 1. Clone this repository: `git clone --depth 1 https://github.com/sainnhe/zsh-completions.git` 30 | 2. Update submodules: `cd zsh-completions; git submodule init; git submodule update` 31 | 3. Add this to your `~/.zshrc`: `source /path/to/zsh-completions/zsh-completions.plugin.zsh` 32 | 33 | ## License 34 | 35 | See each submodule for detailed license information. 36 | 37 | Other code goes to [MIT License](./LICENSE). 38 | -------------------------------------------------------------------------------- /src/custom/_asdf: -------------------------------------------------------------------------------- 1 | #compdef asdf 2 | #description tool to manage versions of multiple runtimes 3 | 4 | # Initialize local variables for ZSH completion context 5 | local state subcmd 6 | 7 | # Set asdf directory path, using ASDF_DATA_DIR if set, otherwise default to ~/.asdf 8 | local asdf_dir="${ASDF_DATA_DIR:-$HOME/.asdf}" 9 | 10 | # Define plugin management commands 11 | local -a asdf_plugin_commands 12 | asdf_plugin_commands=( 13 | 'add:add plugin from asdf-plugins repo or from git URL' 14 | 'list:list installed plugins (--urls with URLs)' 15 | 'remove:remove named plugin and all packages for it' 16 | 'update:update named plugin (or --all)' 17 | ) 18 | 19 | # Define main asdf commands array with descriptions 20 | local -a asdf_commands 21 | asdf_commands=( # 'asdf help' lists commands with help text 22 | # Plugin related commands 23 | 'plugin:plugin management sub-commands' 24 | 25 | # tools 26 | 'help:Output documentation for plugin and tool' 27 | 'install:install tool at stated version, or all from .tools-versions' 28 | 'uninstall:remove a specific version of a tool' 29 | 'current:display current versions for named tool (else all)' 30 | 'latest:display latest version available to install for a named tool' 31 | 'where:display install path for given tool at optional specified version' 32 | 'which:display path to an executable' 33 | 'set:Set a tool version in a .tool-version file' 34 | 'list:list installed versions of a tool' 35 | 36 | # Utility commands 37 | 'exec:executes the command shim for the current version' 38 | 'env:prints or runs an executable under a command environment' 39 | 'info:print os, shell and asdf debug information' 40 | 'version:print the currently installed version of ASDF' 41 | 'reshim:recreate shims for version of a tool' 42 | 'shim:shim management sub-commands' 43 | 'shimversions:list for given command which plugins and versions provide it' 44 | ) 45 | 46 | # Function to list all available plugins from the repository 47 | _asdf__available_plugins() { 48 | local plugin_dir="${asdf_dir:?}/repository/plugins" 49 | if [[ ! -d "$plugin_dir" ]]; then 50 | _wanted asdf-available-plugins expl 'ASDF Installable Plugins' \ 51 | compadd -x "no plugins repository found" 52 | return 53 | fi 54 | local -a plugins 55 | plugins=( "$plugin_dir"/*(:t) ) 56 | _wanted asdf-available-plugins expl 'ASDF Installable Plugins' \ 57 | compadd -a plugins 58 | } 59 | 60 | # Function to list currently installed plugins 61 | _asdf__installed_plugins() { 62 | local plugin_dir="${asdf_dir:?}/plugins" 63 | if [[ ! -d "$plugin_dir" ]]; then 64 | _wanted asdf-plugins expl 'ASDF Plugins' \ 65 | compadd -x "no plugins dir, none installed yet" 66 | return 67 | fi 68 | local -a plugins 69 | plugins=( "$plugin_dir"/*(:t) ) 70 | _wanted asdf-plugins expl 'ASDF Plugins' \ 71 | compadd -a plugins 72 | } 73 | 74 | # Function to list installed versions for a specific plugin 75 | _asdf__installed_versions_of() { 76 | local plugin_dir="${asdf_dir:?}/installs/${1:?need a plugin version}" 77 | if [[ ! -d "$plugin_dir" ]]; then 78 | _wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \ 79 | compadd -x "no versions installed" 80 | return 81 | fi 82 | local -a versions 83 | versions=( "$plugin_dir"/*(:t) ) 84 | _wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \ 85 | compadd -a versions 86 | } 87 | 88 | # Similar to _asdf__installed_versions_of but includes 'system' as an option 89 | _asdf__installed_versions_of_plus_system() { 90 | local plugin_dir="${asdf_dir:?}/installs/${1:?need a plugin version}" 91 | if [[ ! -d "$plugin_dir" ]]; then 92 | _wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \ 93 | compadd -x "no versions installed" 94 | return 95 | fi 96 | local -a versions 97 | versions=( "$plugin_dir"/*(:t) ) 98 | versions+="system" 99 | _wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \ 100 | compadd -a versions 101 | } 102 | 103 | # Function to get available git references for a plugin 104 | _asdf__plugin_git_refs() { 105 | local plugin=$1 106 | local data_dir=${ASDF_DATA_DIR:-$HOME/.asdf} 107 | local plugin_path="$data_dir/plugins/$plugin" 108 | 109 | if [[ -d "$plugin_path/.git" ]]; then 110 | # Get remote branches and format them 111 | git -C "$plugin_path" branch -r 2> /dev/null | \ 112 | sed \ 113 | -e 's/^[[:space:]]*[^\/]*\///' \ 114 | -e 's/[[:space:]]*->.*$//' \ 115 | -e 's/\(.*\)/\1:Remote branch \1/' | \ 116 | sort -fd 117 | # Get tags and format them 118 | git -C "$plugin_path" tag 2> /dev/null | \ 119 | sed -e 's/\(.*\)/\1:Tag \1/' | \ 120 | sort -V 121 | # Get recent commit hashes and messages (last 10 commits) 122 | git -C "$plugin_path" log --pretty=format:'%h:%s' -n 10 2> /dev/null 123 | fi 124 | } 125 | 126 | # Handle top-level command completion first 127 | if (( CURRENT == 2 )); then 128 | _arguments -C : '--version[version]' ':command:->command' 129 | fi 130 | 131 | # Process command state for top-level commands 132 | case "$state" in 133 | (command) 134 | _describe -t asdf-commands 'ASDF Commands' asdf_commands 135 | return 136 | ;; 137 | esac 138 | 139 | # Get the subcommand for further processing 140 | subcmd="${words[2]}" 141 | 142 | # Complex completion logic for each subcommand 143 | # Each case handles specific completion scenarios for the respective command 144 | case "$subcmd" in 145 | (plugin) 146 | # Handle plugin subcommand completions with nested subcommands 147 | if (( CURRENT == 3 )); then 148 | _describe -t asdf-plugin-commands 'ASDF Plugin Commands' asdf_plugin_commands 149 | else 150 | local plugin_subcmd="${words[3]}" 151 | case "$plugin_subcmd" in 152 | (add) 153 | # Complete available plugins or URLs for add command 154 | if (( CURRENT == 4 )); then 155 | _asdf__available_plugins 156 | elif (( CURRENT == 5 )); then 157 | _arguments "*:${words[4]} plugin url:_urls" 158 | fi 159 | return 160 | ;; 161 | (update) 162 | # Handle update command with support for --all flag and git refs 163 | if (( CURRENT == 4 )); then 164 | _alternative \ 165 | 'flags:flags:((--all\:"Update all installed plugins"))' \ 166 | 'asdf-available-plugins:Installed ASDF Plugins:_asdf__installed_plugins' 167 | elif (( CURRENT == 5 )); then 168 | if [[ ${words[4]} != "--all" ]]; then 169 | local -a refs 170 | while IFS=: read -r value descr; do 171 | refs+=( "${value}:${descr}" ) 172 | done < <(_asdf__plugin_git_refs ${words[4]}) 173 | _describe -V -t git-refs 'Git References' refs 174 | fi 175 | fi 176 | ;; 177 | (remove) 178 | # Complete installed plugin names for remove command 179 | _asdf__installed_plugins 180 | return 181 | ;; 182 | (list) 183 | # Handle list command options with support for --urls and --refs flags 184 | case $CURRENT in 185 | 4) 186 | _alternative \ 187 | 'flags:flags:((--urls\:"Show repository URLs" --refs\:"Show Git references"))' \ 188 | 'commands:commands:((all\:"List all available plugins"))' 189 | return 190 | ;; 191 | 5) 192 | # Handle remaining available flags 193 | if [[ ${words[4]} == --* ]]; then 194 | local used_flags=("${words[@]}") 195 | local -a available_flags 196 | available_flags=() 197 | if [[ ! "${used_flags[@]}" =~ "--urls" ]]; then 198 | available_flags+=("--urls") 199 | fi 200 | if [[ ! "${used_flags[@]}" =~ "--refs" ]]; then 201 | available_flags+=("--refs") 202 | fi 203 | (( ${#available_flags[@]} )) && compadd -- "${available_flags[@]}" 204 | fi 205 | return 206 | ;; 207 | esac 208 | ;; 209 | esac 210 | fi 211 | ;; 212 | (current) 213 | # Complete with installed plugins for current command 214 | _asdf__installed_plugins 215 | ;; 216 | (list) 217 | # Handle list command completions with support for 'all' and specific plugins 218 | case $CURRENT in 219 | 3) 220 | _alternative \ 221 | 'commands:commands:((all\:"List all available (remote) versions"))' \ 222 | 'plugin:plugin:_asdf__installed_plugins' 223 | ;; 224 | 4) 225 | if [[ ${words[3]} == "all" ]]; then 226 | _asdf__installed_plugins 227 | else 228 | # For normal list: show installed versions with optional filter 229 | _asdf__installed_versions_of ${words[3]} 230 | fi 231 | ;; 232 | 5) 233 | # When listing all versions of a specific plugin 234 | if [[ ${words[3]} == "all" ]]; then 235 | local versions 236 | if versions=$(asdf list all "${words[4]}" 2>/dev/null); then 237 | _wanted "remote-versions-${words[4]}" \ 238 | expl "Available versions of ${words[4]}" \ 239 | compadd -- ${(f)versions} 240 | else 241 | _message "Unable to fetch versions for ${words[4]}" 242 | fi 243 | fi 244 | ;; 245 | esac 246 | ;; 247 | (help) 248 | # Complete installed plugins and their versions for help command 249 | if (( CURRENT == 3 )); then 250 | _asdf__installed_plugins 251 | elif (( CURRENT == 4 )); then 252 | _asdf__installed_versions_of ${words[3]} 253 | fi 254 | ;; 255 | (install) 256 | # Handle complex install command completion with latest tag support 257 | if (( CURRENT == 3 )); then 258 | _asdf__installed_plugins 259 | return 260 | elif (( CURRENT == 4 )); then 261 | local tool="${words[3]}" 262 | local ver_prefix="${words[4]}" 263 | if [[ $ver_prefix == latest:* ]]; then 264 | # Handle latest: syntax 265 | _wanted "latest-versions-$tool" \ 266 | expl "Latest version" \ 267 | compadd -- latest:${^$(asdf list all "$tool")} 268 | else 269 | # Offer both latest options and specific versions 270 | _wanted "latest-tag-$tool" \ 271 | expl "Latest version" \ 272 | compadd -- 'latest' 'latest:' 273 | _wanted "remote-versions-$tool" \ 274 | expl "Available versions of $tool" \ 275 | compadd -- $(asdf list all "$tool") 276 | fi 277 | return 278 | fi 279 | ;; 280 | (latest) 281 | # Complete plugin names or --all flag for latest command 282 | if (( CURRENT == 3 )); then 283 | _alternative \ 284 | 'flags:flags:((--all\:"Show latest version of all tools"))' \ 285 | 'asdf-available-plugins:Installed ASDF Plugins:_asdf__installed_plugins' 286 | fi 287 | ;; 288 | (uninstall|reshim|where) 289 | # Handle complex install command completion with latest tag support 290 | if (( CURRENT == 3 )); then 291 | _asdf__installed_plugins 292 | return 293 | elif (( CURRENT == 4 )); then 294 | # For normal list: show installed versions with optional filter 295 | _asdf__installed_versions_of ${words[3]} 296 | return 297 | fi 298 | ;; 299 | (set) 300 | # Handle set command completion 301 | case $CURRENT in 302 | 3) 303 | _alternative \ 304 | 'flags:flags:((-u\:"set version in user home directory" -p\:"set version in closest parent .tool-versions"))' \ 305 | 'plugin:plugin:_asdf__installed_plugins' 306 | ;; 307 | 4) 308 | if [[ ${words[3]} == -* ]]; then 309 | # After flag, complete with plugin name 310 | _asdf__installed_plugins 311 | else 312 | # Complete with available versions for the plugin 313 | local versions 314 | if versions=$(asdf list all "${words[3]}" 2>/dev/null); then 315 | _wanted "versions-${words[3]}" \ 316 | expl "Available versions of ${words[3]}" \ 317 | compadd -- ${(f)versions} 318 | fi 319 | fi 320 | ;; 321 | *) 322 | # Support for multiple version specifications 323 | if [[ ${words[3]} == -* ]]; then 324 | local plugin="${words[4]}" 325 | else 326 | local plugin="${words[3]}" 327 | fi 328 | local versions 329 | if versions=$(asdf list all "$plugin" 2>/dev/null); then 330 | _wanted "versions-$plugin" \ 331 | expl "Available versions of $plugin" \ 332 | compadd -- ${(f)versions} 333 | fi 334 | ;; 335 | esac 336 | ;; 337 | (which|shimversions) 338 | # Complete with available shims for which and shimversions commands 339 | _wanted asdf-shims expl "ASDF Shims" compadd -- "${asdf_dir:?}/shims"/*(:t) 340 | ;; 341 | (exec) 342 | # Handle exec command completion with shim command and args 343 | if (( CURRENT == 3 )); then 344 | _wanted asdf-shims expl "ASDF Shims" compadd -- "${asdf_dir:?}/shims"/*(:t) 345 | else 346 | compset -n 3 347 | _normal -p "asdf-shims-${words[3]}" 348 | fi 349 | ;; 350 | (env) 351 | # Handle env command completion with shim name and arbitrary command 352 | if (( CURRENT == 3 )); then 353 | _wanted asdf-shims expl "ASDF Shims" compadd -- "${asdf_dir:?}/shims"/*(:t) 354 | else 355 | compset -n 4 356 | _normal -p "asdf-shims-${words[3]}" 357 | fi 358 | ;; 359 | esac 360 | -------------------------------------------------------------------------------- /src/custom/_axel: -------------------------------------------------------------------------------- 1 | #compdef axel 2 | 3 | # zsh completions for 'axel' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {--max-speed,-s}'[specify maximum speed (bytes per second)]' 9 | {--num-connections,-n}'[specify maximum number of connections]' 10 | '--max-redirect[specify maximum number of redirections]' 11 | {--output,-o}'[specify local output file]' 12 | {--search,-S}'[search for mirrors and download from n servers]' 13 | {--ipv4,-4}'[use the IPv4 protocol]' 14 | {--ipv6,-6}'[use the IPv6 protocol]' 15 | {--header,-H}'[add HTTP header string]' 16 | {--user-agent,-U}'[set user agent]' 17 | {--no-proxy,-N}'[just dont use any proxy server]' 18 | {--insecure,-k}'[dont verify the SSL certificate]' 19 | {--no-clobber,-c}'[skip download if file already exists]' 20 | {--quiet,-q}'[leave stdout alone]' 21 | {--verbose,-v}'[more status information]' 22 | {--alternate,-a}'[alternate progress indicator]' 23 | {--percentage,-p}'[print simple percentages instead of progress bar (0-100)]' 24 | {--help,-h}'[this information]' 25 | {--timeout,-T}'[set I/O and connection timeout]' 26 | {--version,-V}'[version information]' 27 | '*:filename:_files' 28 | ) 29 | 30 | _arguments -s $arguments 31 | -------------------------------------------------------------------------------- /src/custom/_cargo: -------------------------------------------------------------------------------- 1 | #compdef cargo 2 | if command -v rustc >/dev/null 2>&1; then 3 | source "$(rustc --print sysroot)"/share/zsh/site-functions/_cargo 4 | fi 5 | -------------------------------------------------------------------------------- /src/custom/_cargo-clippy: -------------------------------------------------------------------------------- 1 | #compdef cargo-clippy 2 | 3 | # zsh completions for 'cargo-clippy' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | '--no-deps[run Clippy only on the given crate, without linting the dependencies]' 9 | '--fix[automatically apply lint suggestions. This flag implies --no-deps and --all-targets]' 10 | {-h,--help}'[print this message]' 11 | {-V,--version}'[print version info and exit]' 12 | '--explain[print the documentation for a given lint]' 13 | {-W,--warn}'[set lint warnings]' 14 | {-A,--allow}'[set lint allowed]' 15 | {-D,--deny}'[set lint denied]' 16 | {-F,--forbid}'[set lint forbidden]' 17 | '--manifest-path[path to Cargo.toml]' 18 | '--frozen[require Cargo.lock and cache are up to date]' 19 | '--locked[require Cargo.lock is up to date]' 20 | '--offline[run without accessing the network]' 21 | '*:filename:_files' 22 | ) 23 | 24 | _arguments -s $arguments 25 | -------------------------------------------------------------------------------- /src/custom/_cargo-fmt: -------------------------------------------------------------------------------- 1 | #compdef cargo-fmt 2 | 3 | # zsh completions for 'cargo-fmt' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-q,--quiet}'[no output printed to stdout]' 9 | {-v,--verbose}'[use verbose output]' 10 | '--version[print rustfmt version and exit]' 11 | {-p,--package}'[...]' 12 | '--manifest-path[specify path to Cargo.toml]' 13 | '--message-format[specify message-format: short|json|human]' 14 | '--all[format all packages, and also their local path-based dependencies]' 15 | '--check[run rustfmt in check mode]' 16 | {-h,--help}'[print help]' 17 | '*:filename:_files' 18 | ) 19 | 20 | _arguments -s $arguments 21 | -------------------------------------------------------------------------------- /src/custom/_dasht: -------------------------------------------------------------------------------- 1 | #compdef dasht dasht-query-html dasht-query-line 2 | 3 | if (( CURRENT == 2 )); then 4 | _dasht_pattern 5 | else 6 | _dasht_docsets 7 | fi 8 | -------------------------------------------------------------------------------- /src/custom/_dasht_docsets: -------------------------------------------------------------------------------- 1 | #compdef dasht-docsets dasht-docsets-remove dasht-docsets-update 2 | 3 | compadd -P '\^' -S '\$' -- $(dasht-docsets | tr 'A-Z' 'a-z') 4 | -------------------------------------------------------------------------------- /src/custom/_dasht_pattern: -------------------------------------------------------------------------------- 1 | #compdef 2 | 3 | compadd -i "'" -I "'" -- '' 4 | -------------------------------------------------------------------------------- /src/custom/_dasht_query_exec: -------------------------------------------------------------------------------- 1 | #compdef dasht-query-exec 2 | 3 | if (( CURRENT == 2 )); then 4 | _dasht_pattern 5 | elif (( CURRENT == 3 )); then 6 | _files 7 | fi 8 | -------------------------------------------------------------------------------- /src/custom/_docker-compose: -------------------------------------------------------------------------------- 1 | #compdef docker-compose 2 | 3 | # Description 4 | # ----------- 5 | # zsh completion for docker-compose 6 | # ------------------------------------------------------------------------- 7 | # Authors 8 | # ------- 9 | # * Steve Durrheimer 10 | # ------------------------------------------------------------------------- 11 | # Inspiration 12 | # ----------- 13 | # * @albers docker-compose bash completion script 14 | # * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion 15 | # ------------------------------------------------------------------------- 16 | 17 | __docker-compose_q() { 18 | docker-compose 2>/dev/null $compose_options "$@" 19 | } 20 | 21 | # All services defined in docker-compose.yml 22 | __docker-compose_all_services_in_compose_file() { 23 | local already_selected 24 | local -a services 25 | already_selected=$(echo $words | tr " " "|") 26 | __docker-compose_q ps --services "$@" \ 27 | | grep -Ev "^(${already_selected})$" 28 | } 29 | 30 | # All services, even those without an existing container 31 | __docker-compose_services_all() { 32 | [[ $PREFIX = -* ]] && return 1 33 | integer ret=1 34 | services=$(__docker-compose_all_services_in_compose_file "$@") 35 | _alternative "args:services:($services)" && ret=0 36 | 37 | return ret 38 | } 39 | 40 | # All services that are defined by a Dockerfile reference 41 | __docker-compose_services_from_build() { 42 | [[ $PREFIX = -* ]] && return 1 43 | __docker-compose_services_all --filter source=build 44 | } 45 | 46 | # All services that are defined by an image 47 | __docker-compose_services_from_image() { 48 | [[ $PREFIX = -* ]] && return 1 49 | __docker-compose_services_all --filter source=image 50 | } 51 | 52 | __docker-compose_pausedservices() { 53 | [[ $PREFIX = -* ]] && return 1 54 | __docker-compose_services_all --filter status=paused 55 | } 56 | 57 | __docker-compose_stoppedservices() { 58 | [[ $PREFIX = -* ]] && return 1 59 | __docker-compose_services_all --filter status=stopped 60 | } 61 | 62 | __docker-compose_runningservices() { 63 | [[ $PREFIX = -* ]] && return 1 64 | __docker-compose_services_all --filter status=running 65 | } 66 | 67 | __docker-compose_services() { 68 | [[ $PREFIX = -* ]] && return 1 69 | __docker-compose_services_all 70 | } 71 | 72 | __docker-compose_caching_policy() { 73 | oldp=( "$1"(Nmh+1) ) # 1 hour 74 | (( $#oldp )) 75 | } 76 | 77 | __docker-compose_commands() { 78 | local cache_policy 79 | 80 | zstyle -s ":completion:${curcontext}:" cache-policy cache_policy 81 | if [[ -z "$cache_policy" ]]; then 82 | zstyle ":completion:${curcontext}:" cache-policy __docker-compose_caching_policy 83 | fi 84 | 85 | if ( [[ ${+_docker_compose_subcommands} -eq 0 ]] || _cache_invalid docker_compose_subcommands) \ 86 | && ! _retrieve_cache docker_compose_subcommands; 87 | then 88 | local -a lines 89 | lines=(${(f)"$(_call_program commands docker-compose 2>&1)"}) 90 | _docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) 91 | (( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands 92 | fi 93 | _describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands 94 | } 95 | 96 | __docker-compose_subcommand() { 97 | local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps 98 | 99 | opts_help='(: -)--help[Print usage]' 100 | opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]" 101 | opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]" 102 | opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]" 103 | opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]" 104 | opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ") 105 | opts_no_color='--no-color[Produce monochrome output.]' 106 | opts_no_deps="--no-deps[Don't start linked services.]" 107 | 108 | integer ret=1 109 | 110 | case "$words[1]" in 111 | (build) 112 | _arguments \ 113 | $opts_help \ 114 | "*--build-arg=[Set build-time variables for one service.]:=: " \ 115 | '--force-rm[Always remove intermediate containers.]' \ 116 | '(--quiet -q)'{--quiet,-q}'[Curb build output]' \ 117 | '(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \ 118 | '--no-cache[Do not use cache when building the image.]' \ 119 | '--pull[Always attempt to pull a newer version of the image.]' \ 120 | '--compress[Compress the build context using gzip.]' \ 121 | '--parallel[Build images in parallel.]' \ 122 | '*:services:__docker-compose_services_from_build' && ret=0 123 | ;; 124 | (config) 125 | _arguments \ 126 | $opts_help \ 127 | '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ 128 | '--resolve-image-digests[Pin image tags to digests.]' \ 129 | '--services[Print the service names, one per line.]' \ 130 | '--volumes[Print the volume names, one per line.]' \ 131 | '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0 132 | ;; 133 | (create) 134 | _arguments \ 135 | $opts_help \ 136 | $opts_force_recreate \ 137 | $opts_no_recreate \ 138 | $opts_no_build \ 139 | "(--no-build)--build[Build images before creating containers.]" \ 140 | '*:services:__docker-compose_services' && ret=0 141 | ;; 142 | (down) 143 | _arguments \ 144 | $opts_help \ 145 | $opts_timeout \ 146 | "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ 147 | '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ 148 | $opts_remove_orphans && ret=0 149 | ;; 150 | (events) 151 | _arguments \ 152 | $opts_help \ 153 | '--json[Output events as a stream of json objects]' \ 154 | '*:services:__docker-compose_services' && ret=0 155 | ;; 156 | (exec) 157 | _arguments \ 158 | $opts_help \ 159 | '-d[Detached mode: Run command in the background.]' \ 160 | '--privileged[Give extended privileges to the process.]' \ 161 | '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ 162 | '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ 163 | '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ 164 | '*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ 165 | '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ 166 | '(-):running services:__docker-compose_runningservices' \ 167 | '(-):command: _command_names -e' \ 168 | '*::arguments: _normal' && ret=0 169 | ;; 170 | (help) 171 | _arguments ':subcommand:__docker-compose_commands' && ret=0 172 | ;; 173 | (images) 174 | _arguments \ 175 | $opts_help \ 176 | '-q[Only display IDs]' \ 177 | '*:services:__docker-compose_services' && ret=0 178 | ;; 179 | (kill) 180 | _arguments \ 181 | $opts_help \ 182 | '-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \ 183 | '*:running services:__docker-compose_runningservices' && ret=0 184 | ;; 185 | (logs) 186 | _arguments \ 187 | $opts_help \ 188 | '(-f --follow)'{-f,--follow}'[Follow log output]' \ 189 | $opts_no_color \ 190 | '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ 191 | '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ 192 | '*:services:__docker-compose_services' && ret=0 193 | ;; 194 | (pause) 195 | _arguments \ 196 | $opts_help \ 197 | '*:running services:__docker-compose_runningservices' && ret=0 198 | ;; 199 | (port) 200 | _arguments \ 201 | $opts_help \ 202 | '--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \ 203 | '--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ 204 | '1:running services:__docker-compose_runningservices' \ 205 | '2:port:_ports' && ret=0 206 | ;; 207 | (ps) 208 | _arguments \ 209 | $opts_help \ 210 | '-q[Only display IDs]' \ 211 | '--filter KEY=VAL[Filter services by a property]:=:' \ 212 | '*:services:__docker-compose_services' && ret=0 213 | ;; 214 | (pull) 215 | _arguments \ 216 | $opts_help \ 217 | '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ 218 | '--no-parallel[Disable parallel pulling]' \ 219 | '(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \ 220 | '--include-deps[Also pull services declared as dependencies]' \ 221 | '*:services:__docker-compose_services_from_image' && ret=0 222 | ;; 223 | (push) 224 | _arguments \ 225 | $opts_help \ 226 | '--ignore-push-failures[Push what it can and ignores images with push failures.]' \ 227 | '*:services:__docker-compose_services' && ret=0 228 | ;; 229 | (rm) 230 | _arguments \ 231 | $opts_help \ 232 | '(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \ 233 | '-v[Remove any anonymous volumes attached to containers]' \ 234 | '*:stopped services:__docker-compose_stoppedservices' && ret=0 235 | ;; 236 | (run) 237 | _arguments \ 238 | $opts_help \ 239 | $opts_no_deps \ 240 | '-d[Detached mode: Run container in the background, print new container name.]' \ 241 | '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ 242 | '*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \ 243 | '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ 244 | '--name=[Assign a name to the container]:name: ' \ 245 | '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ 246 | '--rm[Remove container after run. Ignored in detached mode.]' \ 247 | "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ 248 | '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ 249 | '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ 250 | '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \ 251 | '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ 252 | "--use-aliases[Use the services network aliases in the network(s) the container connects to]" \ 253 | '(-):services:__docker-compose_services' \ 254 | '(-):command: _command_names -e' \ 255 | '*::arguments: _normal' && ret=0 256 | ;; 257 | (scale) 258 | _arguments \ 259 | $opts_help \ 260 | $opts_timeout \ 261 | '*:running services:__docker-compose_runningservices' && ret=0 262 | ;; 263 | (start) 264 | _arguments \ 265 | $opts_help \ 266 | '*:stopped services:__docker-compose_stoppedservices' && ret=0 267 | ;; 268 | (stop|restart) 269 | _arguments \ 270 | $opts_help \ 271 | $opts_timeout \ 272 | '*:running services:__docker-compose_runningservices' && ret=0 273 | ;; 274 | (top) 275 | _arguments \ 276 | $opts_help \ 277 | '*:running services:__docker-compose_runningservices' && ret=0 278 | ;; 279 | (unpause) 280 | _arguments \ 281 | $opts_help \ 282 | '*:paused services:__docker-compose_pausedservices' && ret=0 283 | ;; 284 | (up) 285 | _arguments \ 286 | $opts_help \ 287 | '(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit and --attach-dependencies.]' \ 288 | $opts_no_color \ 289 | $opts_no_deps \ 290 | $opts_force_recreate \ 291 | $opts_no_recreate \ 292 | $opts_no_build \ 293 | "(--no-build)--build[Build images before starting containers.]" \ 294 | "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ 295 | "(-d)--attach-dependencies[Attach to dependent containers. Incompatible with -d.]" \ 296 | '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ 297 | '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \ 298 | '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \ 299 | $opts_remove_orphans \ 300 | '*:services:__docker-compose_services' && ret=0 301 | ;; 302 | (version) 303 | _arguments \ 304 | $opts_help \ 305 | "--short[Shows only Compose's version number.]" && ret=0 306 | ;; 307 | (*) 308 | _message 'Unknown sub command' && ret=1 309 | ;; 310 | esac 311 | 312 | return ret 313 | } 314 | 315 | _docker-compose() { 316 | # Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. 317 | # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. 318 | if [[ $service != docker-compose ]]; then 319 | _call_function - _$service 320 | return 321 | fi 322 | 323 | local curcontext="$curcontext" state line 324 | integer ret=1 325 | typeset -A opt_args 326 | 327 | local file_description 328 | 329 | if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then 330 | file_description="Specify an override docker-compose file (default: docker-compose.override.yml)" 331 | else 332 | file_description="Specify an alternate docker-compose file (default: docker-compose.yml)" 333 | fi 334 | 335 | _arguments -C \ 336 | '(- :)'{-h,--help}'[Get help]' \ 337 | '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ 338 | '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ 339 | '--env-file[Specify an alternate environment file (default: .env)]:env-file:_files' \ 340 | "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \ 341 | '(- :)'{-v,--version}'[Print version and exit]' \ 342 | '--verbose[Show more output]' \ 343 | '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \ 344 | '--no-ansi[Do not print ANSI control characters]' \ 345 | '--ansi=[Control when to print ANSI control characters]:when:(never always auto)' \ 346 | '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ 347 | '--tls[Use TLS; implied by --tlsverify]' \ 348 | '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ 349 | '--tlscert=[Path to TLS certificate file]:client cert path:' \ 350 | '--tlskey=[Path to TLS key file]:tls key path:' \ 351 | '--tlsverify[Use TLS and verify the remote]' \ 352 | "--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \ 353 | '(-): :->command' \ 354 | '(-)*:: :->option-or-argument' && ret=0 355 | 356 | local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options 357 | 358 | relevant_compose_flags=( 359 | "--env-file" 360 | "--file" "-f" 361 | "--host" "-H" 362 | "--project-name" "-p" 363 | "--tls" 364 | "--tlscacert" 365 | "--tlscert" 366 | "--tlskey" 367 | "--tlsverify" 368 | "--skip-hostname-check" 369 | ) 370 | 371 | relevant_compose_repeatable_flags=( 372 | "--file" "-f" 373 | ) 374 | 375 | relevant_docker_flags=( 376 | "--host" "-H" 377 | "--tls" 378 | "--tlscacert" 379 | "--tlscert" 380 | "--tlskey" 381 | "--tlsverify" 382 | ) 383 | 384 | for k in "${(@k)opt_args}"; do 385 | if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then 386 | docker_options+=$k 387 | if [[ -n "$opt_args[$k]" ]]; then 388 | docker_options+=$opt_args[$k] 389 | fi 390 | fi 391 | if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then 392 | if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then 393 | values=("${(@s/:/)opt_args[$k]}") 394 | for value in $values 395 | do 396 | compose_options+=$k 397 | compose_options+=$value 398 | done 399 | else 400 | compose_options+=$k 401 | if [[ -n "$opt_args[$k]" ]]; then 402 | compose_options+=$opt_args[$k] 403 | fi 404 | fi 405 | fi 406 | done 407 | 408 | case $state in 409 | (command) 410 | __docker-compose_commands && ret=0 411 | ;; 412 | (option-or-argument) 413 | curcontext=${curcontext%:*:*}:docker-compose-$words[1]: 414 | __docker-compose_subcommand && ret=0 415 | ;; 416 | esac 417 | 418 | return ret 419 | } 420 | 421 | _docker-compose "$@" 422 | -------------------------------------------------------------------------------- /src/custom/_fd: -------------------------------------------------------------------------------- 1 | #compdef fd 2 | 3 | ## 4 | # zsh completion function for fd 5 | # 6 | # Based on ripgrep completion function. 7 | # Originally based on code from the zsh-users project — see copyright notice 8 | # below. 9 | 10 | autoload -U is-at-least 11 | 12 | _fd() { 13 | local curcontext="$curcontext" no='!' ret=1 14 | local -a context line state state_descr _arguments_options fd_types fd_args 15 | local -A opt_args 16 | 17 | if is-at-least 5.2; then 18 | _arguments_options=( -s -S ) 19 | else 20 | _arguments_options=( -s ) 21 | fi 22 | 23 | fd_types=( 24 | {f,file}'\:"regular files"' 25 | {d,directory}'\:"directories"' 26 | {l,symlink}'\:"symbolic links"' 27 | {e,empty}'\:"empty files or directories"' 28 | {x,executable}'\:"executable (files)"' 29 | {b,block-device}'\:"block devices"' 30 | {c,char-device}'\:"character devices"' 31 | {s,socket}'\:"sockets"' 32 | {p,pipe}'\:"named pipes (FIFOs)"' 33 | ) 34 | 35 | # Do not complete rare options unless either the current prefix 36 | # matches one of those options or the user has the `complete-all` 37 | # style set. Note that this prefix check has to be updated manually to account 38 | # for all of the potential negation options listed below! 39 | if 40 | # (--[bpsu]* => match all options marked with '$no') 41 | [[ $PREFIX$SUFFIX == --[bopsun]* ]] || 42 | zstyle -t ":complete:$curcontext:*" complete-all 43 | then 44 | no= 45 | fi 46 | 47 | # We make heavy use of argument groups here to prevent the option specs from 48 | # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip 49 | # them out below if necessary. This makes the exclusions inaccurate on those 50 | # older versions, but oh well — it's not that big a deal 51 | fd_args=( 52 | + '(hidden)' # hidden files 53 | {-H,--hidden}'[search hidden files/directories]' 54 | 55 | + '(no-ignore-full)' # all ignore files 56 | '(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]" 57 | $no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]' 58 | 59 | + no-ignore-partial # some ignore files 60 | "(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]" 61 | "!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]" 62 | $no'(no-ignore-full --no-ignore-parent)--no-ignore-parent[]' 63 | 64 | + '(case)' # case-sensitivity 65 | {-s,--case-sensitive}'[perform a case-sensitive search]' 66 | {-i,--ignore-case}'[perform a case-insensitive search]' 67 | 68 | + '(regex-pattern)' # regex-based search pattern 69 | '(no-regex-pattern)--regex[perform a regex-based search (default)]' 70 | 71 | + '(no-regex-pattern)' # non-regex-based search pattern 72 | {-g,--glob}'[perform a glob-based search]' 73 | {-F,--fixed-strings}'[treat pattern as literal string instead of a regex]' 74 | 75 | + '(no-require-git)' 76 | "$no(no-ignore-full --no-ignore-vcs --no-require-git)--no-require-git[don't require git repo to respect gitignores]" 77 | 78 | + '(match-full)' # match against full path 79 | {-p,--full-path}'[match the pattern against the full path instead of the basename]' 80 | 81 | + '(follow)' # follow symlinks 82 | {-L,--follow}'[follow symbolic links to directories]' 83 | 84 | + '(abs-path)' # show absolute paths 85 | '(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]' 86 | 87 | + '(null-sep)' # use null separator for output 88 | '(long-listing)'{-0,--print0}'[separate search results by the null character]' 89 | 90 | + '(long-listing)' # long-listing output 91 | '(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]' 92 | 93 | + '(max-results)' # max number of results 94 | '(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count' 95 | '(long-listing exec-cmds)-1[limit to a single search result and quit]' 96 | 97 | + '(fs-errors)' # file-system errors 98 | $no'--show-errors[enable the display of filesystem errors]' 99 | 100 | + '(fs-traversal)' # file-system traversal 101 | $no"--one-file-system[don't descend into directories on other file systems]" 102 | '!--mount' 103 | '!--xdev' 104 | 105 | + dir-depth # directory depth 106 | '(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth' 107 | '!(--exact-depth -d --max-depth)--maxdepth:depth' 108 | '(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth' 109 | '(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth' 110 | 111 | + prune # pruning 112 | "--prune[don't traverse into matching directories]" 113 | 114 | + filter-misc # filter search 115 | '*'{-t+,--type=}"[filter search by type]:type:(($fd_types))" 116 | '*'{-e+,--extension=}'[filter search by file extension]:extension' 117 | '*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern' 118 | '*'{-S+,--size=}'[limit search by file size]:size limit:->size' 119 | '(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner' 120 | 121 | + ignore-file # extra ignore files 122 | '*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files' 123 | 124 | + '(filter-mtime-newer)' # filter by files modified after than 125 | '--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration' 126 | '--changed-after=[alias for --changed-within]:date/duration' 127 | '!--change-newer-than=:date/duration' 128 | '!--newer=:date/duration' 129 | 130 | + '(filter-mtime-older)' # filter by files modified before than 131 | '--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration' 132 | '!--change-older-than=:date/duration' 133 | '!--older=:date/duration' 134 | 135 | + '(color)' # colorize output 136 | {-c+,--color=}'[declare when to colorize search results]:when to colorize:(( 137 | auto\:"show colors if the output goes to an interactive console (default)" 138 | never\:"do not use colorized output" 139 | always\:"always use colorized output" 140 | ))' 141 | 142 | '--hyperlink=-[add hyperlinks to output paths]::when:(auto never always)' 143 | 144 | + '(threads)' 145 | {-j+,--threads=}'[set the number of threads for searching and executing]:number of threads' 146 | 147 | + '(exec-cmds)' # execute command 148 | '(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal' 149 | '(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal' 150 | '(long-listing max-results)--batch-size=[max number of args for each -X call]:size' 151 | 152 | + other 153 | '!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)' 154 | 155 | + '(about)' # about flags 156 | '(: * -)'{-h,--help}'[display help message]' 157 | '(: * -)'{-V,--version}'[display version information]' 158 | 159 | + path-sep # set path separator for output 160 | $no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator' 161 | 162 | + search-path 163 | $no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/' 164 | $no'(*)*--search-path=[set search path (instead of positional arguments)]:directory:_files -/' 165 | 166 | + strip-cwd-prefix 167 | $no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix=-[When to strip ./]::when:(always never auto)' 168 | 169 | + and 170 | '--and=[additional required search path]:pattern' 171 | 172 | 173 | + args # positional arguments 174 | '1: :_guard "^-*" pattern' 175 | '(--search-path)*:directory:_files -/' 176 | ) 177 | 178 | # Strip out argument groups where unsupported (see above) 179 | is-at-least 5.4 || 180 | fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} ) 181 | 182 | _arguments $_arguments_options : $fd_args && ret=0 183 | 184 | case ${state} in 185 | owner) 186 | compset -P '(\\|)\!' 187 | if compset -P '*:'; then 188 | _groups && ret=0 189 | else 190 | if 191 | compset -S ':*' || 192 | # Do not add the colon suffix when completing "!user 193 | # (with a starting double-quote) otherwise pressing tab again 194 | # after the inserted colon "!user: will complete history modifiers 195 | [[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]] 196 | then 197 | _users && ret=0 198 | else 199 | local q 200 | # Since quotes are needed when using the negation prefix !, 201 | # automatically remove the colon suffix also when closing the quote 202 | if [[ $QIPREFIX == [\'\"]* ]]; then 203 | q=${QIPREFIX:0:1} 204 | fi 205 | _users -r ": \t\n\-$q" -S : && ret=0 206 | fi 207 | fi 208 | ;; 209 | 210 | size) 211 | if compset -P '[-+][0-9]##'; then 212 | local -a suff=( 213 | 'B:bytes' 214 | 'K:kilobytes (10^3 = 1000 bytes)' 215 | 'M:megabytes (10^6 = 1000^2 bytes)' 216 | 'G:gigabytes (10^9 = 1000^3 bytes)' 217 | 'T:terabytes (10^12 = 1000^4 bytes)' 218 | 'Ki:kibibytes ( 2^10 = 1024 bytes)' 219 | 'Mi:mebibytes ( 2^20 = 1024^2 bytes)' 220 | 'Gi:gigibytes ( 2^30 = 1024^3 bytes)' 221 | 'Ti:tebibytes ( 2^40 = 1024^4 bytes)' 222 | ) 223 | _describe -t units 'size limit units' suff -V 'units' 224 | elif compset -P '[-+]'; then 225 | _message -e 'size limit number (full format: <+->)' 226 | else 227 | _values 'size limit prefix (full format: )' \ 228 | '\+[file size must be greater or equal to]'\ 229 | '-[file size must be less than or equal to]' && ret=0 230 | fi 231 | ;; 232 | esac 233 | 234 | return ret 235 | } 236 | 237 | _fd "$@" 238 | 239 | # ------------------------------------------------------------------------------ 240 | # Copyright (c) 2011 GitHub zsh-users - http://github.com/zsh-users 241 | # All rights reserved. 242 | # 243 | # Redistribution and use in source and binary forms, with or without 244 | # modification, are permitted provided that the following conditions are met: 245 | # * Redistributions of source code must retain the above copyright 246 | # notice, this list of conditions and the following disclaimer. 247 | # * Redistributions in binary form must reproduce the above copyright 248 | # notice, this list of conditions and the following disclaimer in the 249 | # documentation and/or other materials provided with the distribution. 250 | # * Neither the name of the zsh-users nor the 251 | # names of its contributors may be used to endorse or promote products 252 | # derived from this software without specific prior written permission. 253 | # 254 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 255 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 256 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 257 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 258 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 259 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 260 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 261 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 263 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 264 | # ------------------------------------------------------------------------------ 265 | # Description 266 | # ----------- 267 | # 268 | # Completion script for fd 269 | # 270 | # ------------------------------------------------------------------------------ 271 | # Authors 272 | # ------- 273 | # 274 | # * smancill (https://github.com/smancill) 275 | # 276 | # ------------------------------------------------------------------------------ 277 | 278 | # Local Variables: 279 | # mode: shell-script 280 | # coding: utf-8-unix 281 | # indent-tabs-mode: nil 282 | # sh-indentation: 2 283 | # sh-basic-offset: 2 284 | # End: 285 | # vim: ft=zsh sw=2 ts=2 et 286 | -------------------------------------------------------------------------------- /src/custom/_fzf: -------------------------------------------------------------------------------- 1 | #compdef fzf 2 | 3 | # zsh completions for 'fzf' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-e,--exact}'[enable exact-match]' 9 | {-i,--ignore-case}'[case-insensitive match]' 10 | '--smart-case[smart-case match (default)]' 11 | '--scheme[scoring scheme \[default|path|history\]]' 12 | {-n,--nth}'[..\] Comma-separated list of field index expressions]' 13 | '--with-nth[..\] Transform the presentation of each line using]' 14 | '--accept-nth[..\] Define which fields to print on accept]' 15 | {-d,--delimiter}'[field delimiter regex (default: AWK-style)]' 16 | '--literal[do not normalize latin script letters]' 17 | '--tail[maximum number of items to keep in memory]' 18 | '--disabled[do not perform search]' 19 | '--tiebreak[..\] Comma-separated list of sort criteria to apply]' 20 | '--read0[read input delimited by ASCII NUL characters]' 21 | '--print0[print output delimited by ASCII NUL characters]' 22 | '--ansi[enable processing of ANSI color codes]' 23 | '--sync[synchronous search for multi-staged filtering]' 24 | '--style[apply a style preset \[default|minimal|full\[:BORDER_STYLE\]]' 25 | '--color[base scheme (dark|light|16|bw) and/or custom colors]' 26 | '--no-color[disable colors]' 27 | '--no-bold[do not use bold text]' 28 | '--height[~\]HEIGHT\[%\] Display fzf window below the cursor with the given]' 29 | '--min-height[+\] Minimum height when --height is given as a percentage.]' 30 | '--tmux[start fzf in a tmux popup (requires tmux 3.3+)]' 31 | '--layout[choose layout: \[default|reverse|reverse-list\]]' 32 | '--margin[screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)]' 33 | '--padding[padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)]' 34 | '--border[draw border around the finder]' 35 | '--border-label[label to print on the border]' 36 | '--border-label-pos[position of the border label]' 37 | {-m,--multi}'[enable multi-select with tab/shift-tab]' 38 | '--highlight-line[highlight the whole current line]' 39 | '--cycle[enable cyclic scroll]' 40 | '--wrap[enable line wrap]' 41 | '--wrap-sign[indicator for wrapped lines]' 42 | '--no-multi-line[disable multi-line display of items when using --read0]' 43 | '--track[track the current selection when the result is updated]' 44 | '--tac[reverse the order of the input]' 45 | '--gap[render empty lines between each item]' 46 | '--gap-line[draw horizontal line on each gap using the string]' 47 | '--keep-right[keep the right end of the line visible on overflow]' 48 | '--scroll-off[number of screen lines to keep above or below when]' 49 | '--no-hscroll[disable horizontal scroll]' 50 | '--hscroll-off[number of screen columns to keep to the right of the]' 51 | '--jump-labels[label characters for jump mode]' 52 | '--pointer[pointer to the current line (default: ▌ or >)]' 53 | '--marker[multi-select marker (default: ┃ or >)]' 54 | '--marker-multi-line[multi-select marker for multi-line entries;]' 55 | '--ellipsis[ellipsis to show when line is truncated (default: ··)]' 56 | '--tabstop[number of spaces for a tab character (default: 8)]' 57 | '--scrollbar[1\[C2\]\] Scrollbar character(s)]' 58 | '--no-scrollbar[hide scrollbar]' 59 | '--list-border[draw border around the list section]' 60 | '--list-label[label to print on the list border]' 61 | '--list-label-pos[position of the list label]' 62 | '--no-input[disable and hide the input section]' 63 | '--prompt[input prompt (default: > )]' 64 | '--info[finder info style]' 65 | '--info-command[command to generate info line]' 66 | '--separator[draw horizontal separator on info line using the string]' 67 | '--no-separator[hide info line separator]' 68 | '--filepath-word[make word-wise movements respect path separators]' 69 | '--input-border[draw border around the input section]' 70 | '--input-label[label to print on the input border]' 71 | '--input-label-pos[position of the input label]' 72 | '--preview[command to preview highlighted line ({})]' 73 | '--preview-window[preview window layout (default: right:50%)]' 74 | '--preview-border[short for --preview-window=border-STYLE]' 75 | '--preview-label[]' 76 | '--preview-label-pos[same as --border-label and --border-label-pos]' 77 | '--header[string to print as header]' 78 | '--header-lines[the first N lines of the input are treated as header]' 79 | '--header-first[print header before the prompt line]' 80 | '--header-border[draw border around the header section]' 81 | '--header-lines-border[display header from --header-lines with a separate border.]' 82 | '--header-label[label to print on the header border]' 83 | '--header-label-pos[position of the header label]' 84 | {-q,--query}'[start the finder with the given query]' 85 | {-1,--select-1}'[automatically select the only match]' 86 | {-0,--exit-0}'[exit immediately when theres no match]' 87 | {-f,--filter}'[print matches for the initial query and exit]' 88 | '--print-query[print query as the first line]' 89 | '--expect[comma-separated list of keys to complete fzf]' 90 | '--bind[custom key/event bindings]' 91 | '--with-shell[shell command and flags to start child processes with]' 92 | '--listen[start HTTP server to receive actions (POST /)]' 93 | '--walker[\[file\]\[,dir\]\[,follow\]\[,hidden\] (default: file,follow,hidden)]' 94 | '--walker-root[\[...\] List of directories to walk (default: .)]' 95 | '--walker-skip[comma-separated list of directory names to skip]' 96 | '--history[history file]' 97 | '--history-size[maximum number of history entries (default: 1000)]' 98 | '--bash[print script to set up Bash shell integration]' 99 | '--zsh[print script to set up Zsh shell integration]' 100 | '--fish[print script to set up Fish shell integration]' 101 | '--version[display version information and exit]' 102 | '--help[show this message]' 103 | '--man[show man page]' 104 | '*:filename:_files' 105 | ) 106 | 107 | _arguments -s $arguments 108 | -------------------------------------------------------------------------------- /src/custom/_helm: -------------------------------------------------------------------------------- 1 | #compdef helm 2 | compdef _helm helm 3 | 4 | # zsh completion for helm -*- shell-script -*- 5 | 6 | __helm_debug() 7 | { 8 | local file="$BASH_COMP_DEBUG_FILE" 9 | if [[ -n ${file} ]]; then 10 | echo "$*" >> "${file}" 11 | fi 12 | } 13 | 14 | _helm() 15 | { 16 | local shellCompDirectiveError=1 17 | local shellCompDirectiveNoSpace=2 18 | local shellCompDirectiveNoFileComp=4 19 | local shellCompDirectiveFilterFileExt=8 20 | local shellCompDirectiveFilterDirs=16 21 | local shellCompDirectiveKeepOrder=32 22 | 23 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 24 | local -a completions 25 | 26 | __helm_debug "\n========= starting completion logic ==========" 27 | __helm_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 28 | 29 | # The user could have moved the cursor backwards on the command-line. 30 | # We need to trigger completion from the $CURRENT location, so we need 31 | # to truncate the command-line ($words) up to the $CURRENT location. 32 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 33 | words=("${=words[1,CURRENT]}") 34 | __helm_debug "Truncated words[*]: ${words[*]}," 35 | 36 | lastParam=${words[-1]} 37 | lastChar=${lastParam[-1]} 38 | __helm_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 39 | 40 | # For zsh, when completing a flag with an = (e.g., helm -n=) 41 | # completions must be prefixed with the flag 42 | setopt local_options BASH_REMATCH 43 | if [[ "${lastParam}" =~ '-.*=' ]]; then 44 | # We are dealing with a flag with an = 45 | flagPrefix="-P ${BASH_REMATCH}" 46 | fi 47 | 48 | # Prepare the command to obtain completions 49 | requestComp="${words[1]} __complete ${words[2,-1]}" 50 | if [ "${lastChar}" = "" ]; then 51 | # If the last parameter is complete (there is a space following it) 52 | # We add an extra empty parameter so we can indicate this to the go completion code. 53 | __helm_debug "Adding extra empty parameter" 54 | requestComp="${requestComp} \"\"" 55 | fi 56 | 57 | __helm_debug "About to call: eval ${requestComp}" 58 | 59 | # Use eval to handle any environment variables and such 60 | out=$(eval ${requestComp} 2>/dev/null) 61 | __helm_debug "completion output: ${out}" 62 | 63 | # Extract the directive integer following a : from the last line 64 | local lastLine 65 | while IFS='\n' read -r line; do 66 | lastLine=${line} 67 | done < <(printf "%s\n" "${out[@]}") 68 | __helm_debug "last line: ${lastLine}" 69 | 70 | if [ "${lastLine[1]}" = : ]; then 71 | directive=${lastLine[2,-1]} 72 | # Remove the directive including the : and the newline 73 | local suffix 74 | (( suffix=${#lastLine}+2)) 75 | out=${out[1,-$suffix]} 76 | else 77 | # There is no directive specified. Leave $out as is. 78 | __helm_debug "No directive found. Setting do default" 79 | directive=0 80 | fi 81 | 82 | __helm_debug "directive: ${directive}" 83 | __helm_debug "completions: ${out}" 84 | __helm_debug "flagPrefix: ${flagPrefix}" 85 | 86 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 87 | __helm_debug "Completion received error. Ignoring completions." 88 | return 89 | fi 90 | 91 | local activeHelpMarker="_activeHelp_ " 92 | local endIndex=${#activeHelpMarker} 93 | local startIndex=$((${#activeHelpMarker}+1)) 94 | local hasActiveHelp=0 95 | while IFS='\n' read -r comp; do 96 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 97 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 98 | __helm_debug "ActiveHelp found: $comp" 99 | comp="${comp[$startIndex,-1]}" 100 | if [ -n "$comp" ]; then 101 | compadd -x "${comp}" 102 | __helm_debug "ActiveHelp will need delimiter" 103 | hasActiveHelp=1 104 | fi 105 | 106 | continue 107 | fi 108 | 109 | if [ -n "$comp" ]; then 110 | # If requested, completions are returned with a description. 111 | # The description is preceded by a TAB character. 112 | # For zsh's _describe, we need to use a : instead of a TAB. 113 | # We first need to escape any : as part of the completion itself. 114 | comp=${comp//:/\\:} 115 | 116 | local tab="$(printf '\t')" 117 | comp=${comp//$tab/:} 118 | 119 | __helm_debug "Adding completion: ${comp}" 120 | completions+=${comp} 121 | lastComp=$comp 122 | fi 123 | done < <(printf "%s\n" "${out[@]}") 124 | 125 | # Add a delimiter after the activeHelp statements, but only if: 126 | # - there are completions following the activeHelp statements, or 127 | # - file completion will be performed (so there will be choices after the activeHelp) 128 | if [ $hasActiveHelp -eq 1 ]; then 129 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 130 | __helm_debug "Adding activeHelp delimiter" 131 | compadd -x "--" 132 | hasActiveHelp=0 133 | fi 134 | fi 135 | 136 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 137 | __helm_debug "Activating nospace." 138 | noSpace="-S ''" 139 | fi 140 | 141 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 142 | __helm_debug "Activating keep order." 143 | keepOrder="-V" 144 | fi 145 | 146 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 147 | # File extension filtering 148 | local filteringCmd 149 | filteringCmd='_files' 150 | for filter in ${completions[@]}; do 151 | if [ ${filter[1]} != '*' ]; then 152 | # zsh requires a glob pattern to do file filtering 153 | filter="\*.$filter" 154 | fi 155 | filteringCmd+=" -g $filter" 156 | done 157 | filteringCmd+=" ${flagPrefix}" 158 | 159 | __helm_debug "File filtering command: $filteringCmd" 160 | _arguments '*:filename:'"$filteringCmd" 161 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 162 | # File completion for directories only 163 | local subdir 164 | subdir="${completions[1]}" 165 | if [ -n "$subdir" ]; then 166 | __helm_debug "Listing directories in $subdir" 167 | pushd "${subdir}" >/dev/null 2>&1 168 | else 169 | __helm_debug "Listing directories in ." 170 | fi 171 | 172 | local result 173 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 174 | result=$? 175 | if [ -n "$subdir" ]; then 176 | popd >/dev/null 2>&1 177 | fi 178 | return $result 179 | else 180 | __helm_debug "Calling _describe" 181 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 182 | __helm_debug "_describe found some completions" 183 | 184 | # Return the success of having called _describe 185 | return 0 186 | else 187 | __helm_debug "_describe did not find completions." 188 | __helm_debug "Checking if we should do file completion." 189 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 190 | __helm_debug "deactivating file completion" 191 | 192 | # We must return an error code here to let zsh know that there were no 193 | # completions found by _describe; this is what will trigger other 194 | # matching algorithms to attempt to find completions. 195 | # For example zsh can match letters in the middle of words. 196 | return 1 197 | else 198 | # Perform file completion 199 | __helm_debug "Activating file completion" 200 | 201 | # We must return the result of this command, so it must be the 202 | # last command, or else we must store its result to return it. 203 | _arguments '*:filename:_files'" ${flagPrefix}" 204 | fi 205 | fi 206 | fi 207 | } 208 | 209 | # don't run the completion function when being source-ed or eval-ed 210 | if [ "$funcstack[1]" = "_helm" ]; then 211 | _helm 212 | fi 213 | compdef _helm helm -------------------------------------------------------------------------------- /src/custom/_hugo: -------------------------------------------------------------------------------- 1 | #compdef hugo 2 | compdef _hugo hugo 3 | 4 | # zsh completion for hugo -*- shell-script -*- 5 | 6 | __hugo_debug() 7 | { 8 | local file="$BASH_COMP_DEBUG_FILE" 9 | if [[ -n ${file} ]]; then 10 | echo "$*" >> "${file}" 11 | fi 12 | } 13 | 14 | _hugo() 15 | { 16 | local shellCompDirectiveError=1 17 | local shellCompDirectiveNoSpace=2 18 | local shellCompDirectiveNoFileComp=4 19 | local shellCompDirectiveFilterFileExt=8 20 | local shellCompDirectiveFilterDirs=16 21 | local shellCompDirectiveKeepOrder=32 22 | 23 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 24 | local -a completions 25 | 26 | __hugo_debug "\n========= starting completion logic ==========" 27 | __hugo_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 28 | 29 | # The user could have moved the cursor backwards on the command-line. 30 | # We need to trigger completion from the $CURRENT location, so we need 31 | # to truncate the command-line ($words) up to the $CURRENT location. 32 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 33 | words=("${=words[1,CURRENT]}") 34 | __hugo_debug "Truncated words[*]: ${words[*]}," 35 | 36 | lastParam=${words[-1]} 37 | lastChar=${lastParam[-1]} 38 | __hugo_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 39 | 40 | # For zsh, when completing a flag with an = (e.g., hugo -n=) 41 | # completions must be prefixed with the flag 42 | setopt local_options BASH_REMATCH 43 | if [[ "${lastParam}" =~ '-.*=' ]]; then 44 | # We are dealing with a flag with an = 45 | flagPrefix="-P ${BASH_REMATCH}" 46 | fi 47 | 48 | # Prepare the command to obtain completions 49 | requestComp="${words[1]} __complete ${words[2,-1]}" 50 | if [ "${lastChar}" = "" ]; then 51 | # If the last parameter is complete (there is a space following it) 52 | # We add an extra empty parameter so we can indicate this to the go completion code. 53 | __hugo_debug "Adding extra empty parameter" 54 | requestComp="${requestComp} \"\"" 55 | fi 56 | 57 | __hugo_debug "About to call: eval ${requestComp}" 58 | 59 | # Use eval to handle any environment variables and such 60 | out=$(eval ${requestComp} 2>/dev/null) 61 | __hugo_debug "completion output: ${out}" 62 | 63 | # Extract the directive integer following a : from the last line 64 | local lastLine 65 | while IFS='\n' read -r line; do 66 | lastLine=${line} 67 | done < <(printf "%s\n" "${out[@]}") 68 | __hugo_debug "last line: ${lastLine}" 69 | 70 | if [ "${lastLine[1]}" = : ]; then 71 | directive=${lastLine[2,-1]} 72 | # Remove the directive including the : and the newline 73 | local suffix 74 | (( suffix=${#lastLine}+2)) 75 | out=${out[1,-$suffix]} 76 | else 77 | # There is no directive specified. Leave $out as is. 78 | __hugo_debug "No directive found. Setting do default" 79 | directive=0 80 | fi 81 | 82 | __hugo_debug "directive: ${directive}" 83 | __hugo_debug "completions: ${out}" 84 | __hugo_debug "flagPrefix: ${flagPrefix}" 85 | 86 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 87 | __hugo_debug "Completion received error. Ignoring completions." 88 | return 89 | fi 90 | 91 | local activeHelpMarker="_activeHelp_ " 92 | local endIndex=${#activeHelpMarker} 93 | local startIndex=$((${#activeHelpMarker}+1)) 94 | local hasActiveHelp=0 95 | while IFS='\n' read -r comp; do 96 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 97 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 98 | __hugo_debug "ActiveHelp found: $comp" 99 | comp="${comp[$startIndex,-1]}" 100 | if [ -n "$comp" ]; then 101 | compadd -x "${comp}" 102 | __hugo_debug "ActiveHelp will need delimiter" 103 | hasActiveHelp=1 104 | fi 105 | 106 | continue 107 | fi 108 | 109 | if [ -n "$comp" ]; then 110 | # If requested, completions are returned with a description. 111 | # The description is preceded by a TAB character. 112 | # For zsh's _describe, we need to use a : instead of a TAB. 113 | # We first need to escape any : as part of the completion itself. 114 | comp=${comp//:/\\:} 115 | 116 | local tab="$(printf '\t')" 117 | comp=${comp//$tab/:} 118 | 119 | __hugo_debug "Adding completion: ${comp}" 120 | completions+=${comp} 121 | lastComp=$comp 122 | fi 123 | done < <(printf "%s\n" "${out[@]}") 124 | 125 | # Add a delimiter after the activeHelp statements, but only if: 126 | # - there are completions following the activeHelp statements, or 127 | # - file completion will be performed (so there will be choices after the activeHelp) 128 | if [ $hasActiveHelp -eq 1 ]; then 129 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 130 | __hugo_debug "Adding activeHelp delimiter" 131 | compadd -x "--" 132 | hasActiveHelp=0 133 | fi 134 | fi 135 | 136 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 137 | __hugo_debug "Activating nospace." 138 | noSpace="-S ''" 139 | fi 140 | 141 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 142 | __hugo_debug "Activating keep order." 143 | keepOrder="-V" 144 | fi 145 | 146 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 147 | # File extension filtering 148 | local filteringCmd 149 | filteringCmd='_files' 150 | for filter in ${completions[@]}; do 151 | if [ ${filter[1]} != '*' ]; then 152 | # zsh requires a glob pattern to do file filtering 153 | filter="\*.$filter" 154 | fi 155 | filteringCmd+=" -g $filter" 156 | done 157 | filteringCmd+=" ${flagPrefix}" 158 | 159 | __hugo_debug "File filtering command: $filteringCmd" 160 | _arguments '*:filename:'"$filteringCmd" 161 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 162 | # File completion for directories only 163 | local subdir 164 | subdir="${completions[1]}" 165 | if [ -n "$subdir" ]; then 166 | __hugo_debug "Listing directories in $subdir" 167 | pushd "${subdir}" >/dev/null 2>&1 168 | else 169 | __hugo_debug "Listing directories in ." 170 | fi 171 | 172 | local result 173 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 174 | result=$? 175 | if [ -n "$subdir" ]; then 176 | popd >/dev/null 2>&1 177 | fi 178 | return $result 179 | else 180 | __hugo_debug "Calling _describe" 181 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 182 | __hugo_debug "_describe found some completions" 183 | 184 | # Return the success of having called _describe 185 | return 0 186 | else 187 | __hugo_debug "_describe did not find completions." 188 | __hugo_debug "Checking if we should do file completion." 189 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 190 | __hugo_debug "deactivating file completion" 191 | 192 | # We must return an error code here to let zsh know that there were no 193 | # completions found by _describe; this is what will trigger other 194 | # matching algorithms to attempt to find completions. 195 | # For example zsh can match letters in the middle of words. 196 | return 1 197 | else 198 | # Perform file completion 199 | __hugo_debug "Activating file completion" 200 | 201 | # We must return the result of this command, so it must be the 202 | # last command, or else we must store its result to return it. 203 | _arguments '*:filename:_files'" ${flagPrefix}" 204 | fi 205 | fi 206 | fi 207 | } 208 | 209 | # don't run the completion function when being source-ed or eval-ed 210 | if [ "$funcstack[1]" = "_hugo" ]; then 211 | _hugo 212 | fi 213 | -------------------------------------------------------------------------------- /src/custom/_kubectl: -------------------------------------------------------------------------------- 1 | #compdef kubectl 2 | compdef _kubectl kubectl 3 | 4 | # Copyright 2016 The Kubernetes Authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | #compdef kubectl 18 | compdef _kubectl kubectl 19 | 20 | # zsh completion for kubectl -*- shell-script -*- 21 | 22 | __kubectl_debug() 23 | { 24 | local file="$BASH_COMP_DEBUG_FILE" 25 | if [[ -n ${file} ]]; then 26 | echo "$*" >> "${file}" 27 | fi 28 | } 29 | 30 | _kubectl() 31 | { 32 | local shellCompDirectiveError=1 33 | local shellCompDirectiveNoSpace=2 34 | local shellCompDirectiveNoFileComp=4 35 | local shellCompDirectiveFilterFileExt=8 36 | local shellCompDirectiveFilterDirs=16 37 | local shellCompDirectiveKeepOrder=32 38 | 39 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 40 | local -a completions 41 | 42 | __kubectl_debug "\n========= starting completion logic ==========" 43 | __kubectl_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 44 | 45 | # The user could have moved the cursor backwards on the command-line. 46 | # We need to trigger completion from the $CURRENT location, so we need 47 | # to truncate the command-line ($words) up to the $CURRENT location. 48 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 49 | words=("${=words[1,CURRENT]}") 50 | __kubectl_debug "Truncated words[*]: ${words[*]}," 51 | 52 | lastParam=${words[-1]} 53 | lastChar=${lastParam[-1]} 54 | __kubectl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 55 | 56 | # For zsh, when completing a flag with an = (e.g., kubectl -n=) 57 | # completions must be prefixed with the flag 58 | setopt local_options BASH_REMATCH 59 | if [[ "${lastParam}" =~ '-.*=' ]]; then 60 | # We are dealing with a flag with an = 61 | flagPrefix="-P ${BASH_REMATCH}" 62 | fi 63 | 64 | # Prepare the command to obtain completions 65 | requestComp="${words[1]} __complete ${words[2,-1]}" 66 | if [ "${lastChar}" = "" ]; then 67 | # If the last parameter is complete (there is a space following it) 68 | # We add an extra empty parameter so we can indicate this to the go completion code. 69 | __kubectl_debug "Adding extra empty parameter" 70 | requestComp="${requestComp} \"\"" 71 | fi 72 | 73 | __kubectl_debug "About to call: eval ${requestComp}" 74 | 75 | # Use eval to handle any environment variables and such 76 | out=$(eval ${requestComp} 2>/dev/null) 77 | __kubectl_debug "completion output: ${out}" 78 | 79 | # Extract the directive integer following a : from the last line 80 | local lastLine 81 | while IFS='\n' read -r line; do 82 | lastLine=${line} 83 | done < <(printf "%s\n" "${out[@]}") 84 | __kubectl_debug "last line: ${lastLine}" 85 | 86 | if [ "${lastLine[1]}" = : ]; then 87 | directive=${lastLine[2,-1]} 88 | # Remove the directive including the : and the newline 89 | local suffix 90 | (( suffix=${#lastLine}+2)) 91 | out=${out[1,-$suffix]} 92 | else 93 | # There is no directive specified. Leave $out as is. 94 | __kubectl_debug "No directive found. Setting do default" 95 | directive=0 96 | fi 97 | 98 | __kubectl_debug "directive: ${directive}" 99 | __kubectl_debug "completions: ${out}" 100 | __kubectl_debug "flagPrefix: ${flagPrefix}" 101 | 102 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 103 | __kubectl_debug "Completion received error. Ignoring completions." 104 | return 105 | fi 106 | 107 | local activeHelpMarker="_activeHelp_ " 108 | local endIndex=${#activeHelpMarker} 109 | local startIndex=$((${#activeHelpMarker}+1)) 110 | local hasActiveHelp=0 111 | while IFS='\n' read -r comp; do 112 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 113 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 114 | __kubectl_debug "ActiveHelp found: $comp" 115 | comp="${comp[$startIndex,-1]}" 116 | if [ -n "$comp" ]; then 117 | compadd -x "${comp}" 118 | __kubectl_debug "ActiveHelp will need delimiter" 119 | hasActiveHelp=1 120 | fi 121 | 122 | continue 123 | fi 124 | 125 | if [ -n "$comp" ]; then 126 | # If requested, completions are returned with a description. 127 | # The description is preceded by a TAB character. 128 | # For zsh's _describe, we need to use a : instead of a TAB. 129 | # We first need to escape any : as part of the completion itself. 130 | comp=${comp//:/\\:} 131 | 132 | local tab="$(printf '\t')" 133 | comp=${comp//$tab/:} 134 | 135 | __kubectl_debug "Adding completion: ${comp}" 136 | completions+=${comp} 137 | lastComp=$comp 138 | fi 139 | done < <(printf "%s\n" "${out[@]}") 140 | 141 | # Add a delimiter after the activeHelp statements, but only if: 142 | # - there are completions following the activeHelp statements, or 143 | # - file completion will be performed (so there will be choices after the activeHelp) 144 | if [ $hasActiveHelp -eq 1 ]; then 145 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 146 | __kubectl_debug "Adding activeHelp delimiter" 147 | compadd -x "--" 148 | hasActiveHelp=0 149 | fi 150 | fi 151 | 152 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 153 | __kubectl_debug "Activating nospace." 154 | noSpace="-S ''" 155 | fi 156 | 157 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 158 | __kubectl_debug "Activating keep order." 159 | keepOrder="-V" 160 | fi 161 | 162 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 163 | # File extension filtering 164 | local filteringCmd 165 | filteringCmd='_files' 166 | for filter in ${completions[@]}; do 167 | if [ ${filter[1]} != '*' ]; then 168 | # zsh requires a glob pattern to do file filtering 169 | filter="\*.$filter" 170 | fi 171 | filteringCmd+=" -g $filter" 172 | done 173 | filteringCmd+=" ${flagPrefix}" 174 | 175 | __kubectl_debug "File filtering command: $filteringCmd" 176 | _arguments '*:filename:'"$filteringCmd" 177 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 178 | # File completion for directories only 179 | local subdir 180 | subdir="${completions[1]}" 181 | if [ -n "$subdir" ]; then 182 | __kubectl_debug "Listing directories in $subdir" 183 | pushd "${subdir}" >/dev/null 2>&1 184 | else 185 | __kubectl_debug "Listing directories in ." 186 | fi 187 | 188 | local result 189 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 190 | result=$? 191 | if [ -n "$subdir" ]; then 192 | popd >/dev/null 2>&1 193 | fi 194 | return $result 195 | else 196 | __kubectl_debug "Calling _describe" 197 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 198 | __kubectl_debug "_describe found some completions" 199 | 200 | # Return the success of having called _describe 201 | return 0 202 | else 203 | __kubectl_debug "_describe did not find completions." 204 | __kubectl_debug "Checking if we should do file completion." 205 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 206 | __kubectl_debug "deactivating file completion" 207 | 208 | # We must return an error code here to let zsh know that there were no 209 | # completions found by _describe; this is what will trigger other 210 | # matching algorithms to attempt to find completions. 211 | # For example zsh can match letters in the middle of words. 212 | return 1 213 | else 214 | # Perform file completion 215 | __kubectl_debug "Activating file completion" 216 | 217 | # We must return the result of this command, so it must be the 218 | # last command, or else we must store its result to return it. 219 | _arguments '*:filename:_files'" ${flagPrefix}" 220 | fi 221 | fi 222 | fi 223 | } 224 | 225 | # don't run the completion function when being source-ed or eval-ed 226 | if [ "$funcstack[1]" = "_kubectl" ]; then 227 | _kubectl 228 | fi 229 | -------------------------------------------------------------------------------- /src/custom/_limactl: -------------------------------------------------------------------------------- 1 | #compdef limactl 2 | 3 | # zsh completion for limactl -*- shell-script -*- 4 | 5 | __limactl_debug() 6 | { 7 | local file="$BASH_COMP_DEBUG_FILE" 8 | if [[ -n ${file} ]]; then 9 | echo "$*" >> "${file}" 10 | fi 11 | } 12 | 13 | _limactl() 14 | { 15 | local shellCompDirectiveError=1 16 | local shellCompDirectiveNoSpace=2 17 | local shellCompDirectiveNoFileComp=4 18 | local shellCompDirectiveFilterFileExt=8 19 | local shellCompDirectiveFilterDirs=16 20 | 21 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace 22 | local -a completions 23 | 24 | __limactl_debug "\n========= starting completion logic ==========" 25 | __limactl_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 26 | 27 | # The user could have moved the cursor backwards on the command-line. 28 | # We need to trigger completion from the $CURRENT location, so we need 29 | # to truncate the command-line ($words) up to the $CURRENT location. 30 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 31 | words=("${=words[1,CURRENT]}") 32 | __limactl_debug "Truncated words[*]: ${words[*]}," 33 | 34 | lastParam=${words[-1]} 35 | lastChar=${lastParam[-1]} 36 | __limactl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 37 | 38 | # For zsh, when completing a flag with an = (e.g., limactl -n=) 39 | # completions must be prefixed with the flag 40 | setopt local_options BASH_REMATCH 41 | if [[ "${lastParam}" =~ '-.*=' ]]; then 42 | # We are dealing with a flag with an = 43 | flagPrefix="-P ${BASH_REMATCH}" 44 | fi 45 | 46 | # Prepare the command to obtain completions 47 | requestComp="${words[1]} __complete ${words[2,-1]}" 48 | if [ "${lastChar}" = "" ]; then 49 | # If the last parameter is complete (there is a space following it) 50 | # We add an extra empty parameter so we can indicate this to the go completion code. 51 | __limactl_debug "Adding extra empty parameter" 52 | requestComp="${requestComp} \"\"" 53 | fi 54 | 55 | __limactl_debug "About to call: eval ${requestComp}" 56 | 57 | # Use eval to handle any environment variables and such 58 | out=$(eval ${requestComp} 2>/dev/null) 59 | __limactl_debug "completion output: ${out}" 60 | 61 | # Extract the directive integer following a : from the last line 62 | local lastLine 63 | while IFS='\n' read -r line; do 64 | lastLine=${line} 65 | done < <(printf "%s\n" "${out[@]}") 66 | __limactl_debug "last line: ${lastLine}" 67 | 68 | if [ "${lastLine[1]}" = : ]; then 69 | directive=${lastLine[2,-1]} 70 | # Remove the directive including the : and the newline 71 | local suffix 72 | (( suffix=${#lastLine}+2)) 73 | out=${out[1,-$suffix]} 74 | else 75 | # There is no directive specified. Leave $out as is. 76 | __limactl_debug "No directive found. Setting do default" 77 | directive=0 78 | fi 79 | 80 | __limactl_debug "directive: ${directive}" 81 | __limactl_debug "completions: ${out}" 82 | __limactl_debug "flagPrefix: ${flagPrefix}" 83 | 84 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 85 | __limactl_debug "Completion received error. Ignoring completions." 86 | return 87 | fi 88 | 89 | local activeHelpMarker="_activeHelp_ " 90 | local endIndex=${#activeHelpMarker} 91 | local startIndex=$((${#activeHelpMarker}+1)) 92 | local hasActiveHelp=0 93 | while IFS='\n' read -r comp; do 94 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 95 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 96 | __limactl_debug "ActiveHelp found: $comp" 97 | comp="${comp[$startIndex,-1]}" 98 | if [ -n "$comp" ]; then 99 | compadd -x "${comp}" 100 | __limactl_debug "ActiveHelp will need delimiter" 101 | hasActiveHelp=1 102 | fi 103 | 104 | continue 105 | fi 106 | 107 | if [ -n "$comp" ]; then 108 | # If requested, completions are returned with a description. 109 | # The description is preceded by a TAB character. 110 | # For zsh's _describe, we need to use a : instead of a TAB. 111 | # We first need to escape any : as part of the completion itself. 112 | comp=${comp//:/\\:} 113 | 114 | local tab="$(printf '\t')" 115 | comp=${comp//$tab/:} 116 | 117 | __limactl_debug "Adding completion: ${comp}" 118 | completions+=${comp} 119 | lastComp=$comp 120 | fi 121 | done < <(printf "%s\n" "${out[@]}") 122 | 123 | # Add a delimiter after the activeHelp statements, but only if: 124 | # - there are completions following the activeHelp statements, or 125 | # - file completion will be performed (so there will be choices after the activeHelp) 126 | if [ $hasActiveHelp -eq 1 ]; then 127 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 128 | __limactl_debug "Adding activeHelp delimiter" 129 | compadd -x "--" 130 | hasActiveHelp=0 131 | fi 132 | fi 133 | 134 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 135 | __limactl_debug "Activating nospace." 136 | noSpace="-S ''" 137 | fi 138 | 139 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 140 | # File extension filtering 141 | local filteringCmd 142 | filteringCmd='_files' 143 | for filter in ${completions[@]}; do 144 | if [ ${filter[1]} != '*' ]; then 145 | # zsh requires a glob pattern to do file filtering 146 | filter="\*.$filter" 147 | fi 148 | filteringCmd+=" -g $filter" 149 | done 150 | filteringCmd+=" ${flagPrefix}" 151 | 152 | __limactl_debug "File filtering command: $filteringCmd" 153 | _arguments '*:filename:'"$filteringCmd" 154 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 155 | # File completion for directories only 156 | local subdir 157 | subdir="${completions[1]}" 158 | if [ -n "$subdir" ]; then 159 | __limactl_debug "Listing directories in $subdir" 160 | pushd "${subdir}" >/dev/null 2>&1 161 | else 162 | __limactl_debug "Listing directories in ." 163 | fi 164 | 165 | local result 166 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 167 | result=$? 168 | if [ -n "$subdir" ]; then 169 | popd >/dev/null 2>&1 170 | fi 171 | return $result 172 | else 173 | __limactl_debug "Calling _describe" 174 | if eval _describe "completions" completions $flagPrefix $noSpace; then 175 | __limactl_debug "_describe found some completions" 176 | 177 | # Return the success of having called _describe 178 | return 0 179 | else 180 | __limactl_debug "_describe did not find completions." 181 | __limactl_debug "Checking if we should do file completion." 182 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 183 | __limactl_debug "deactivating file completion" 184 | 185 | # We must return an error code here to let zsh know that there were no 186 | # completions found by _describe; this is what will trigger other 187 | # matching algorithms to attempt to find completions. 188 | # For example zsh can match letters in the middle of words. 189 | return 1 190 | else 191 | # Perform file completion 192 | __limactl_debug "Activating file completion" 193 | 194 | # We must return the result of this command, so it must be the 195 | # last command, or else we must store its result to return it. 196 | _arguments '*:filename:_files'" ${flagPrefix}" 197 | fi 198 | fi 199 | fi 200 | } 201 | 202 | # don't run the completion function when being source-ed or eval-ed 203 | if [ "$funcstack[1]" = "_limactl" ]; then 204 | _limactl 205 | fi 206 | -------------------------------------------------------------------------------- /src/custom/_mdbook: -------------------------------------------------------------------------------- 1 | #compdef mdbook 2 | 3 | autoload -U is-at-least 4 | 5 | _mdbook() { 6 | typeset -A opt_args 7 | typeset -a _arguments_options 8 | local ret=1 9 | 10 | if is-at-least 5.2; then 11 | _arguments_options=(-s -S -C) 12 | else 13 | _arguments_options=(-s -C) 14 | fi 15 | 16 | local context curcontext="$curcontext" state line 17 | _arguments "${_arguments_options[@]}" \ 18 | '-h[Print help]' \ 19 | '--help[Print help]' \ 20 | '-V[Print version]' \ 21 | '--version[Print version]' \ 22 | ":: :_mdbook_commands" \ 23 | "*::: :->mdbook" \ 24 | && ret=0 25 | case $state in 26 | (mdbook) 27 | words=($line[1] "${words[@]}") 28 | (( CURRENT += 1 )) 29 | curcontext="${curcontext%:*:*}:mdbook-command-$line[1]:" 30 | case $line[1] in 31 | (init) 32 | _arguments "${_arguments_options[@]}" \ 33 | '--title=[Sets the book title]:title: ' \ 34 | '--ignore=[Creates a VCS ignore file (i.e. .gitignore)]:ignore:(none git)' \ 35 | '--theme[Copies the default theme into your source folder]' \ 36 | '--force[Skips confirmation prompts]' \ 37 | '-h[Print help]' \ 38 | '--help[Print help]' \ 39 | '-V[Print version]' \ 40 | '--version[Print version]' \ 41 | '::dir -- Directory to create the book in 42 | (Defaults to the current directory when omitted):_files' \ 43 | && ret=0 44 | ;; 45 | (build) 46 | _arguments "${_arguments_options[@]}" \ 47 | '-d+[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 48 | '--dest-dir=[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 49 | '-o[Opens the compiled book in a web browser]' \ 50 | '--open[Opens the compiled book in a web browser]' \ 51 | '-h[Print help]' \ 52 | '--help[Print help]' \ 53 | '-V[Print version]' \ 54 | '--version[Print version]' \ 55 | '::dir -- Root directory for the book 56 | (Defaults to the current directory when omitted):_files' \ 57 | && ret=0 58 | ;; 59 | (test) 60 | _arguments "${_arguments_options[@]}" \ 61 | '-d+[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 62 | '--dest-dir=[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 63 | '-c+[]:chapter: ' \ 64 | '--chapter=[]:chapter: ' \ 65 | '*-L+[A comma-separated list of directories to add to the crate search path when building tests]:dir: ' \ 66 | '*--library-path=[A comma-separated list of directories to add to the crate search path when building tests]:dir: ' \ 67 | '-h[Print help]' \ 68 | '--help[Print help]' \ 69 | '-V[Print version]' \ 70 | '--version[Print version]' \ 71 | '::dir -- Root directory for the book 72 | (Defaults to the current directory when omitted):_files' \ 73 | && ret=0 74 | ;; 75 | (clean) 76 | _arguments "${_arguments_options[@]}" \ 77 | '-d+[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 78 | '--dest-dir=[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 79 | '-h[Print help]' \ 80 | '--help[Print help]' \ 81 | '-V[Print version]' \ 82 | '--version[Print version]' \ 83 | '::dir -- Root directory for the book 84 | (Defaults to the current directory when omitted):_files' \ 85 | && ret=0 86 | ;; 87 | (completions) 88 | _arguments "${_arguments_options[@]}" \ 89 | '-h[Print help]' \ 90 | '--help[Print help]' \ 91 | '-V[Print version]' \ 92 | '--version[Print version]' \ 93 | ':shell -- the shell to generate completions for:(bash elvish fish powershell zsh)' \ 94 | && ret=0 95 | ;; 96 | (watch) 97 | _arguments "${_arguments_options[@]}" \ 98 | '-d+[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 99 | '--dest-dir=[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 100 | '--watcher=[The filesystem watching technique]: :(poll native)' \ 101 | '-o[Opens the compiled book in a web browser]' \ 102 | '--open[Opens the compiled book in a web browser]' \ 103 | '-h[Print help]' \ 104 | '--help[Print help]' \ 105 | '-V[Print version]' \ 106 | '--version[Print version]' \ 107 | '::dir -- Root directory for the book 108 | (Defaults to the current directory when omitted):_files' \ 109 | && ret=0 110 | ;; 111 | (serve) 112 | _arguments "${_arguments_options[@]}" \ 113 | '-d+[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 114 | '--dest-dir=[Output directory for the book Relative paths are interpreted relative to the book'\''s root directory. If omitted, mdBook uses build.build-dir from book.toml or defaults to \`./book\`.]:dest-dir:_files' \ 115 | '-n+[Hostname to listen on for HTTP connections]: : ' \ 116 | '--hostname=[Hostname to listen on for HTTP connections]: : ' \ 117 | '-p+[Port to use for HTTP connections]: : ' \ 118 | '--port=[Port to use for HTTP connections]: : ' \ 119 | '--watcher=[The filesystem watching technique]: :(poll native)' \ 120 | '-o[Opens the compiled book in a web browser]' \ 121 | '--open[Opens the compiled book in a web browser]' \ 122 | '-h[Print help]' \ 123 | '--help[Print help]' \ 124 | '-V[Print version]' \ 125 | '--version[Print version]' \ 126 | '::dir -- Root directory for the book 127 | (Defaults to the current directory when omitted):_files' \ 128 | && ret=0 129 | ;; 130 | (help) 131 | _arguments "${_arguments_options[@]}" \ 132 | ":: :_mdbook__help_commands" \ 133 | "*::: :->help" \ 134 | && ret=0 135 | 136 | case $state in 137 | (help) 138 | words=($line[1] "${words[@]}") 139 | (( CURRENT += 1 )) 140 | curcontext="${curcontext%:*:*}:mdbook-help-command-$line[1]:" 141 | case $line[1] in 142 | (init) 143 | _arguments "${_arguments_options[@]}" \ 144 | && ret=0 145 | ;; 146 | (build) 147 | _arguments "${_arguments_options[@]}" \ 148 | && ret=0 149 | ;; 150 | (test) 151 | _arguments "${_arguments_options[@]}" \ 152 | && ret=0 153 | ;; 154 | (clean) 155 | _arguments "${_arguments_options[@]}" \ 156 | && ret=0 157 | ;; 158 | (completions) 159 | _arguments "${_arguments_options[@]}" \ 160 | && ret=0 161 | ;; 162 | (watch) 163 | _arguments "${_arguments_options[@]}" \ 164 | && ret=0 165 | ;; 166 | (serve) 167 | _arguments "${_arguments_options[@]}" \ 168 | && ret=0 169 | ;; 170 | (help) 171 | _arguments "${_arguments_options[@]}" \ 172 | && ret=0 173 | ;; 174 | esac 175 | ;; 176 | esac 177 | ;; 178 | esac 179 | ;; 180 | esac 181 | } 182 | 183 | (( $+functions[_mdbook_commands] )) || 184 | _mdbook_commands() { 185 | local commands; commands=( 186 | 'init:Creates the boilerplate structure and files for a new book' \ 187 | 'build:Builds a book from its markdown files' \ 188 | 'test:Tests that a book'\''s Rust code samples compile' \ 189 | 'clean:Deletes a built book' \ 190 | 'completions:Generate shell completions for your shell to stdout' \ 191 | 'watch:Watches a book'\''s files and rebuilds it on changes' \ 192 | 'serve:Serves a book at http\://localhost\:3000, and rebuilds it on changes' \ 193 | 'help:Print this message or the help of the given subcommand(s)' \ 194 | ) 195 | _describe -t commands 'mdbook commands' commands "$@" 196 | } 197 | (( $+functions[_mdbook__build_commands] )) || 198 | _mdbook__build_commands() { 199 | local commands; commands=() 200 | _describe -t commands 'mdbook build commands' commands "$@" 201 | } 202 | (( $+functions[_mdbook__help__build_commands] )) || 203 | _mdbook__help__build_commands() { 204 | local commands; commands=() 205 | _describe -t commands 'mdbook help build commands' commands "$@" 206 | } 207 | (( $+functions[_mdbook__clean_commands] )) || 208 | _mdbook__clean_commands() { 209 | local commands; commands=() 210 | _describe -t commands 'mdbook clean commands' commands "$@" 211 | } 212 | (( $+functions[_mdbook__help__clean_commands] )) || 213 | _mdbook__help__clean_commands() { 214 | local commands; commands=() 215 | _describe -t commands 'mdbook help clean commands' commands "$@" 216 | } 217 | (( $+functions[_mdbook__completions_commands] )) || 218 | _mdbook__completions_commands() { 219 | local commands; commands=() 220 | _describe -t commands 'mdbook completions commands' commands "$@" 221 | } 222 | (( $+functions[_mdbook__help__completions_commands] )) || 223 | _mdbook__help__completions_commands() { 224 | local commands; commands=() 225 | _describe -t commands 'mdbook help completions commands' commands "$@" 226 | } 227 | (( $+functions[_mdbook__help_commands] )) || 228 | _mdbook__help_commands() { 229 | local commands; commands=( 230 | 'init:Creates the boilerplate structure and files for a new book' \ 231 | 'build:Builds a book from its markdown files' \ 232 | 'test:Tests that a book'\''s Rust code samples compile' \ 233 | 'clean:Deletes a built book' \ 234 | 'completions:Generate shell completions for your shell to stdout' \ 235 | 'watch:Watches a book'\''s files and rebuilds it on changes' \ 236 | 'serve:Serves a book at http\://localhost\:3000, and rebuilds it on changes' \ 237 | 'help:Print this message or the help of the given subcommand(s)' \ 238 | ) 239 | _describe -t commands 'mdbook help commands' commands "$@" 240 | } 241 | (( $+functions[_mdbook__help__help_commands] )) || 242 | _mdbook__help__help_commands() { 243 | local commands; commands=() 244 | _describe -t commands 'mdbook help help commands' commands "$@" 245 | } 246 | (( $+functions[_mdbook__help__init_commands] )) || 247 | _mdbook__help__init_commands() { 248 | local commands; commands=() 249 | _describe -t commands 'mdbook help init commands' commands "$@" 250 | } 251 | (( $+functions[_mdbook__init_commands] )) || 252 | _mdbook__init_commands() { 253 | local commands; commands=() 254 | _describe -t commands 'mdbook init commands' commands "$@" 255 | } 256 | (( $+functions[_mdbook__help__serve_commands] )) || 257 | _mdbook__help__serve_commands() { 258 | local commands; commands=() 259 | _describe -t commands 'mdbook help serve commands' commands "$@" 260 | } 261 | (( $+functions[_mdbook__serve_commands] )) || 262 | _mdbook__serve_commands() { 263 | local commands; commands=() 264 | _describe -t commands 'mdbook serve commands' commands "$@" 265 | } 266 | (( $+functions[_mdbook__help__test_commands] )) || 267 | _mdbook__help__test_commands() { 268 | local commands; commands=() 269 | _describe -t commands 'mdbook help test commands' commands "$@" 270 | } 271 | (( $+functions[_mdbook__test_commands] )) || 272 | _mdbook__test_commands() { 273 | local commands; commands=() 274 | _describe -t commands 'mdbook test commands' commands "$@" 275 | } 276 | (( $+functions[_mdbook__help__watch_commands] )) || 277 | _mdbook__help__watch_commands() { 278 | local commands; commands=() 279 | _describe -t commands 'mdbook help watch commands' commands "$@" 280 | } 281 | (( $+functions[_mdbook__watch_commands] )) || 282 | _mdbook__watch_commands() { 283 | local commands; commands=() 284 | _describe -t commands 'mdbook watch commands' commands "$@" 285 | } 286 | 287 | if [ "$funcstack[1]" = "_mdbook" ]; then 288 | _mdbook "$@" 289 | else 290 | compdef _mdbook mdbook 291 | fi 292 | -------------------------------------------------------------------------------- /src/custom/_pnpm: -------------------------------------------------------------------------------- 1 | #compdef pnpm 2 | ###-begin-pnpm-completion-### 3 | if type compdef &>/dev/null; then 4 | _pnpm_completion () { 5 | local reply 6 | local si=$IFS 7 | 8 | IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" SHELL=zsh pnpm completion-server -- "${words[@]}")) 9 | IFS=$si 10 | 11 | if [ "$reply" = "__tabtab_complete_files__" ]; then 12 | _files 13 | else 14 | _describe 'values' reply 15 | fi 16 | } 17 | # When called by the Zsh completion system, this will end with 18 | # "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise, 19 | # the script was "eval"-ed so use "compdef" to register it with the 20 | # completion system 21 | if [[ $zsh_eval_context == *func ]]; then 22 | _pnpm_completion "$@" 23 | else 24 | compdef _pnpm_completion pnpm 25 | fi 26 | fi 27 | ###-end-pnpm-completion-### 28 | 29 | -------------------------------------------------------------------------------- /src/custom/_podman: -------------------------------------------------------------------------------- 1 | #compdef podman 2 | compdef _podman podman 3 | 4 | # zsh completion for podman -*- shell-script -*- 5 | 6 | __podman_debug() 7 | { 8 | local file="$BASH_COMP_DEBUG_FILE" 9 | if [[ -n ${file} ]]; then 10 | echo "$*" >> "${file}" 11 | fi 12 | } 13 | 14 | _podman() 15 | { 16 | local shellCompDirectiveError=1 17 | local shellCompDirectiveNoSpace=2 18 | local shellCompDirectiveNoFileComp=4 19 | local shellCompDirectiveFilterFileExt=8 20 | local shellCompDirectiveFilterDirs=16 21 | local shellCompDirectiveKeepOrder=32 22 | 23 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 24 | local -a completions 25 | 26 | __podman_debug "\n========= starting completion logic ==========" 27 | __podman_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 28 | 29 | # The user could have moved the cursor backwards on the command-line. 30 | # We need to trigger completion from the $CURRENT location, so we need 31 | # to truncate the command-line ($words) up to the $CURRENT location. 32 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 33 | words=("${=words[1,CURRENT]}") 34 | __podman_debug "Truncated words[*]: ${words[*]}," 35 | 36 | lastParam=${words[-1]} 37 | lastChar=${lastParam[-1]} 38 | __podman_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 39 | 40 | # For zsh, when completing a flag with an = (e.g., podman -n=) 41 | # completions must be prefixed with the flag 42 | setopt local_options BASH_REMATCH 43 | if [[ "${lastParam}" =~ '-.*=' ]]; then 44 | # We are dealing with a flag with an = 45 | flagPrefix="-P ${BASH_REMATCH}" 46 | fi 47 | 48 | # Prepare the command to obtain completions 49 | requestComp="${words[1]} __complete ${words[2,-1]}" 50 | if [ "${lastChar}" = "" ]; then 51 | # If the last parameter is complete (there is a space following it) 52 | # We add an extra empty parameter so we can indicate this to the go completion code. 53 | __podman_debug "Adding extra empty parameter" 54 | requestComp="${requestComp} \"\"" 55 | fi 56 | 57 | __podman_debug "About to call: eval ${requestComp}" 58 | 59 | # Use eval to handle any environment variables and such 60 | out=$(eval ${requestComp} 2>/dev/null) 61 | __podman_debug "completion output: ${out}" 62 | 63 | # Extract the directive integer following a : from the last line 64 | local lastLine 65 | while IFS='\n' read -r line; do 66 | lastLine=${line} 67 | done < <(printf "%s\n" "${out[@]}") 68 | __podman_debug "last line: ${lastLine}" 69 | 70 | if [ "${lastLine[1]}" = : ]; then 71 | directive=${lastLine[2,-1]} 72 | # Remove the directive including the : and the newline 73 | local suffix 74 | (( suffix=${#lastLine}+2)) 75 | out=${out[1,-$suffix]} 76 | else 77 | # There is no directive specified. Leave $out as is. 78 | __podman_debug "No directive found. Setting do default" 79 | directive=0 80 | fi 81 | 82 | __podman_debug "directive: ${directive}" 83 | __podman_debug "completions: ${out}" 84 | __podman_debug "flagPrefix: ${flagPrefix}" 85 | 86 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 87 | __podman_debug "Completion received error. Ignoring completions." 88 | return 89 | fi 90 | 91 | local activeHelpMarker="_activeHelp_ " 92 | local endIndex=${#activeHelpMarker} 93 | local startIndex=$((${#activeHelpMarker}+1)) 94 | local hasActiveHelp=0 95 | while IFS='\n' read -r comp; do 96 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 97 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 98 | __podman_debug "ActiveHelp found: $comp" 99 | comp="${comp[$startIndex,-1]}" 100 | if [ -n "$comp" ]; then 101 | compadd -x "${comp}" 102 | __podman_debug "ActiveHelp will need delimiter" 103 | hasActiveHelp=1 104 | fi 105 | 106 | continue 107 | fi 108 | 109 | if [ -n "$comp" ]; then 110 | # If requested, completions are returned with a description. 111 | # The description is preceded by a TAB character. 112 | # For zsh's _describe, we need to use a : instead of a TAB. 113 | # We first need to escape any : as part of the completion itself. 114 | comp=${comp//:/\\:} 115 | 116 | local tab="$(printf '\t')" 117 | comp=${comp//$tab/:} 118 | 119 | __podman_debug "Adding completion: ${comp}" 120 | completions+=${comp} 121 | lastComp=$comp 122 | fi 123 | done < <(printf "%s\n" "${out[@]}") 124 | 125 | # Add a delimiter after the activeHelp statements, but only if: 126 | # - there are completions following the activeHelp statements, or 127 | # - file completion will be performed (so there will be choices after the activeHelp) 128 | if [ $hasActiveHelp -eq 1 ]; then 129 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 130 | __podman_debug "Adding activeHelp delimiter" 131 | compadd -x "--" 132 | hasActiveHelp=0 133 | fi 134 | fi 135 | 136 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 137 | __podman_debug "Activating nospace." 138 | noSpace="-S ''" 139 | fi 140 | 141 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 142 | __podman_debug "Activating keep order." 143 | keepOrder="-V" 144 | fi 145 | 146 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 147 | # File extension filtering 148 | local filteringCmd 149 | filteringCmd='_files' 150 | for filter in ${completions[@]}; do 151 | if [ ${filter[1]} != '*' ]; then 152 | # zsh requires a glob pattern to do file filtering 153 | filter="\*.$filter" 154 | fi 155 | filteringCmd+=" -g $filter" 156 | done 157 | filteringCmd+=" ${flagPrefix}" 158 | 159 | __podman_debug "File filtering command: $filteringCmd" 160 | _arguments '*:filename:'"$filteringCmd" 161 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 162 | # File completion for directories only 163 | local subdir 164 | subdir="${completions[1]}" 165 | if [ -n "$subdir" ]; then 166 | __podman_debug "Listing directories in $subdir" 167 | pushd "${subdir}" >/dev/null 2>&1 168 | else 169 | __podman_debug "Listing directories in ." 170 | fi 171 | 172 | local result 173 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 174 | result=$? 175 | if [ -n "$subdir" ]; then 176 | popd >/dev/null 2>&1 177 | fi 178 | return $result 179 | else 180 | __podman_debug "Calling _describe" 181 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 182 | __podman_debug "_describe found some completions" 183 | 184 | # Return the success of having called _describe 185 | return 0 186 | else 187 | __podman_debug "_describe did not find completions." 188 | __podman_debug "Checking if we should do file completion." 189 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 190 | __podman_debug "deactivating file completion" 191 | 192 | # We must return an error code here to let zsh know that there were no 193 | # completions found by _describe; this is what will trigger other 194 | # matching algorithms to attempt to find completions. 195 | # For example zsh can match letters in the middle of words. 196 | return 1 197 | else 198 | # Perform file completion 199 | __podman_debug "Activating file completion" 200 | 201 | # We must return the result of this command, so it must be the 202 | # last command, or else we must store its result to return it. 203 | _arguments '*:filename:_files'" ${flagPrefix}" 204 | fi 205 | fi 206 | fi 207 | } 208 | 209 | # don't run the completion function when being source-ed or eval-ed 210 | if [ "$funcstack[1]" = "_podman" ]; then 211 | _podman 212 | fi 213 | 214 | # This file is generated with "podman completion"; see: podman-completion(1) 215 | -------------------------------------------------------------------------------- /src/custom/_podman-remote: -------------------------------------------------------------------------------- 1 | #compdef podman-remote 2 | compdef _podman-remote podman-remote 3 | 4 | # zsh completion for podman-remote -*- shell-script -*- 5 | 6 | __podman-remote_debug() 7 | { 8 | local file="$BASH_COMP_DEBUG_FILE" 9 | if [[ -n ${file} ]]; then 10 | echo "$*" >> "${file}" 11 | fi 12 | } 13 | 14 | _podman-remote() 15 | { 16 | local shellCompDirectiveError=1 17 | local shellCompDirectiveNoSpace=2 18 | local shellCompDirectiveNoFileComp=4 19 | local shellCompDirectiveFilterFileExt=8 20 | local shellCompDirectiveFilterDirs=16 21 | local shellCompDirectiveKeepOrder=32 22 | 23 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder 24 | local -a completions 25 | 26 | __podman-remote_debug "\n========= starting completion logic ==========" 27 | __podman-remote_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 28 | 29 | # The user could have moved the cursor backwards on the command-line. 30 | # We need to trigger completion from the $CURRENT location, so we need 31 | # to truncate the command-line ($words) up to the $CURRENT location. 32 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 33 | words=("${=words[1,CURRENT]}") 34 | __podman-remote_debug "Truncated words[*]: ${words[*]}," 35 | 36 | lastParam=${words[-1]} 37 | lastChar=${lastParam[-1]} 38 | __podman-remote_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 39 | 40 | # For zsh, when completing a flag with an = (e.g., podman-remote -n=) 41 | # completions must be prefixed with the flag 42 | setopt local_options BASH_REMATCH 43 | if [[ "${lastParam}" =~ '-.*=' ]]; then 44 | # We are dealing with a flag with an = 45 | flagPrefix="-P ${BASH_REMATCH}" 46 | fi 47 | 48 | # Prepare the command to obtain completions 49 | requestComp="${words[1]} __complete ${words[2,-1]}" 50 | if [ "${lastChar}" = "" ]; then 51 | # If the last parameter is complete (there is a space following it) 52 | # We add an extra empty parameter so we can indicate this to the go completion code. 53 | __podman-remote_debug "Adding extra empty parameter" 54 | requestComp="${requestComp} \"\"" 55 | fi 56 | 57 | __podman-remote_debug "About to call: eval ${requestComp}" 58 | 59 | # Use eval to handle any environment variables and such 60 | out=$(eval ${requestComp} 2>/dev/null) 61 | __podman-remote_debug "completion output: ${out}" 62 | 63 | # Extract the directive integer following a : from the last line 64 | local lastLine 65 | while IFS='\n' read -r line; do 66 | lastLine=${line} 67 | done < <(printf "%s\n" "${out[@]}") 68 | __podman-remote_debug "last line: ${lastLine}" 69 | 70 | if [ "${lastLine[1]}" = : ]; then 71 | directive=${lastLine[2,-1]} 72 | # Remove the directive including the : and the newline 73 | local suffix 74 | (( suffix=${#lastLine}+2)) 75 | out=${out[1,-$suffix]} 76 | else 77 | # There is no directive specified. Leave $out as is. 78 | __podman-remote_debug "No directive found. Setting do default" 79 | directive=0 80 | fi 81 | 82 | __podman-remote_debug "directive: ${directive}" 83 | __podman-remote_debug "completions: ${out}" 84 | __podman-remote_debug "flagPrefix: ${flagPrefix}" 85 | 86 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 87 | __podman-remote_debug "Completion received error. Ignoring completions." 88 | return 89 | fi 90 | 91 | local activeHelpMarker="_activeHelp_ " 92 | local endIndex=${#activeHelpMarker} 93 | local startIndex=$((${#activeHelpMarker}+1)) 94 | local hasActiveHelp=0 95 | while IFS='\n' read -r comp; do 96 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 97 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 98 | __podman-remote_debug "ActiveHelp found: $comp" 99 | comp="${comp[$startIndex,-1]}" 100 | if [ -n "$comp" ]; then 101 | compadd -x "${comp}" 102 | __podman-remote_debug "ActiveHelp will need delimiter" 103 | hasActiveHelp=1 104 | fi 105 | 106 | continue 107 | fi 108 | 109 | if [ -n "$comp" ]; then 110 | # If requested, completions are returned with a description. 111 | # The description is preceded by a TAB character. 112 | # For zsh's _describe, we need to use a : instead of a TAB. 113 | # We first need to escape any : as part of the completion itself. 114 | comp=${comp//:/\\:} 115 | 116 | local tab="$(printf '\t')" 117 | comp=${comp//$tab/:} 118 | 119 | __podman-remote_debug "Adding completion: ${comp}" 120 | completions+=${comp} 121 | lastComp=$comp 122 | fi 123 | done < <(printf "%s\n" "${out[@]}") 124 | 125 | # Add a delimiter after the activeHelp statements, but only if: 126 | # - there are completions following the activeHelp statements, or 127 | # - file completion will be performed (so there will be choices after the activeHelp) 128 | if [ $hasActiveHelp -eq 1 ]; then 129 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 130 | __podman-remote_debug "Adding activeHelp delimiter" 131 | compadd -x "--" 132 | hasActiveHelp=0 133 | fi 134 | fi 135 | 136 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 137 | __podman-remote_debug "Activating nospace." 138 | noSpace="-S ''" 139 | fi 140 | 141 | if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then 142 | __podman-remote_debug "Activating keep order." 143 | keepOrder="-V" 144 | fi 145 | 146 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 147 | # File extension filtering 148 | local filteringCmd 149 | filteringCmd='_files' 150 | for filter in ${completions[@]}; do 151 | if [ ${filter[1]} != '*' ]; then 152 | # zsh requires a glob pattern to do file filtering 153 | filter="\*.$filter" 154 | fi 155 | filteringCmd+=" -g $filter" 156 | done 157 | filteringCmd+=" ${flagPrefix}" 158 | 159 | __podman-remote_debug "File filtering command: $filteringCmd" 160 | _arguments '*:filename:'"$filteringCmd" 161 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 162 | # File completion for directories only 163 | local subdir 164 | subdir="${completions[1]}" 165 | if [ -n "$subdir" ]; then 166 | __podman-remote_debug "Listing directories in $subdir" 167 | pushd "${subdir}" >/dev/null 2>&1 168 | else 169 | __podman-remote_debug "Listing directories in ." 170 | fi 171 | 172 | local result 173 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 174 | result=$? 175 | if [ -n "$subdir" ]; then 176 | popd >/dev/null 2>&1 177 | fi 178 | return $result 179 | else 180 | __podman-remote_debug "Calling _describe" 181 | if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then 182 | __podman-remote_debug "_describe found some completions" 183 | 184 | # Return the success of having called _describe 185 | return 0 186 | else 187 | __podman-remote_debug "_describe did not find completions." 188 | __podman-remote_debug "Checking if we should do file completion." 189 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 190 | __podman-remote_debug "deactivating file completion" 191 | 192 | # We must return an error code here to let zsh know that there were no 193 | # completions found by _describe; this is what will trigger other 194 | # matching algorithms to attempt to find completions. 195 | # For example zsh can match letters in the middle of words. 196 | return 1 197 | else 198 | # Perform file completion 199 | __podman-remote_debug "Activating file completion" 200 | 201 | # We must return the result of this command, so it must be the 202 | # last command, or else we must store its result to return it. 203 | _arguments '*:filename:_files'" ${flagPrefix}" 204 | fi 205 | fi 206 | fi 207 | } 208 | 209 | # don't run the completion function when being source-ed or eval-ed 210 | if [ "$funcstack[1]" = "_podman-remote" ]; then 211 | _podman-remote 212 | fi 213 | 214 | # This file is generated with "podman-remote completion"; see: podman-completion(1) 215 | -------------------------------------------------------------------------------- /src/custom/_proxychains4: -------------------------------------------------------------------------------- 1 | #compdef proxychains4 2 | 3 | _arguments \ 4 | '(- : *)--help[More help in README file]' \ 5 | '-q[makes proxychains quiet - this overrides the config setting]' \ 6 | '-f[allows one to manually specify a configfile to use]: :_files' \ 7 | '(-)1: :{_command_names -e}' \ 8 | '*:: :_normal' 9 | -------------------------------------------------------------------------------- /src/custom/_rg: -------------------------------------------------------------------------------- 1 | #compdef rg 2 | 3 | ## 4 | # zsh completion function for ripgrep 5 | # 6 | # Run ci/test-complete after building to ensure that the options supported by 7 | # this function stay in synch with the `rg` binary. 8 | # 9 | # For convenience, a completion reference guide is included at the bottom of 10 | # this file. 11 | # 12 | # Originally based on code from the zsh-users project — see copyright notice 13 | # below. 14 | 15 | _rg() { 16 | local curcontext=$curcontext no='!' descr ret=1 17 | local -a context line state state_descr args tmp suf 18 | local -A opt_args 19 | 20 | # ripgrep has many options which negate the effect of a more common one — for 21 | # example, `--no-column` to negate `--column`, and `--messages` to negate 22 | # `--no-messages`. There are so many of these, and they're so infrequently 23 | # used, that some users will probably find it irritating if they're completed 24 | # indiscriminately, so let's not do that unless either the current prefix 25 | # matches one of those negation options or the user has the `complete-all` 26 | # style set. Note that this prefix check has to be updated manually to account 27 | # for all of the potential negation options listed below! 28 | if 29 | # We also want to list all of these options during testing 30 | [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] || 31 | # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode) 32 | [[ $PREFIX$SUFFIX == --[imnp]* ]] || 33 | zstyle -t ":completion:${curcontext}:" complete-all 34 | then 35 | no= 36 | fi 37 | 38 | # We make heavy use of argument groups here to prevent the option specs from 39 | # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip 40 | # them out below if necessary. This makes the exclusions inaccurate on those 41 | # older versions, but oh well — it's not that big a deal 42 | args=( 43 | + '(exclusive)' # Misc. fully exclusive options 44 | '(: * -)'{-h,--help}'[display help information]' 45 | '(: * -)'{-V,--version}'[display version information]' 46 | '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]' 47 | 48 | + '(buffered)' # buffering options 49 | '--line-buffered[force line buffering]' 50 | $no"--no-line-buffered[don't force line buffering]" 51 | '--block-buffered[force block buffering]' 52 | $no"--no-block-buffered[don't force block buffering]" 53 | 54 | + '(case)' # Case-sensitivity options 55 | {-i,--ignore-case}'[search case-insensitively]' 56 | {-s,--case-sensitive}'[search case-sensitively]' 57 | {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]' 58 | 59 | + '(context-a)' # Context (after) options 60 | '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines' 61 | 62 | + '(context-b)' # Context (before) options 63 | '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines' 64 | 65 | + '(context-c)' # Context (combined) options 66 | '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines' 67 | 68 | + '(column)' # Column options 69 | '--column[show column numbers for matches]' 70 | $no"--no-column[don't show column numbers for matches]" 71 | 72 | + '(count)' # Counting options 73 | {-c,--count}'[only show count of matching lines for each file]' 74 | '--count-matches[only show count of individual matches for each file]' 75 | '--include-zero[include files with zero matches in summary]' 76 | $no"--no-include-zero[don't include files with zero matches in summary]" 77 | 78 | + '(encoding)' # Encoding options 79 | {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings' 80 | $no'--no-encoding[use default text encoding]' 81 | 82 | + '(engine)' # Engine choice options 83 | '--engine=[select which regex engine to use]:when:(( 84 | default\:"use default engine" 85 | pcre2\:"identical to --pcre2" 86 | auto\:"identical to --auto-hybrid-regex" 87 | ))' 88 | 89 | + file # File-input options 90 | '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files' 91 | 92 | + '(file-match)' # Files with/without match options 93 | '(stats)'{-l,--files-with-matches}'[only show names of files with matches]' 94 | '(stats)--files-without-match[only show names of files without matches]' 95 | 96 | + '(file-name)' # File-name options 97 | {-H,--with-filename}'[show file name for matches]' 98 | {-I,--no-filename}"[don't show file name for matches]" 99 | 100 | + '(file-system)' # File system options 101 | "--one-file-system[don't descend into directories on other file systems]" 102 | $no'--no-one-file-system[descend into directories on other file systems]' 103 | 104 | + '(fixed)' # Fixed-string options 105 | {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]' 106 | $no"--no-fixed-strings[don't treat pattern as literal string]" 107 | 108 | + '(follow)' # Symlink-following options 109 | {-L,--follow}'[follow symlinks]' 110 | $no"--no-follow[don't follow symlinks]" 111 | 112 | + '(generate)' # Options for generating ancillary data 113 | '--generate=[generate man page or completion scripts]:when:(( 114 | man\:"man page" 115 | complete-bash\:"shell completions for bash" 116 | complete-zsh\:"shell completions for zsh" 117 | complete-fish\:"shell completions for fish" 118 | complete-powershell\:"shell completions for PowerShell" 119 | ))' 120 | 121 | + glob # File-glob options 122 | '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob' 123 | '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob' 124 | 125 | + '(glob-case-insensitive)' # File-glob case sensitivity options 126 | '--glob-case-insensitive[treat -g/--glob patterns case insensitively]' 127 | $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]' 128 | 129 | + '(heading)' # Heading options 130 | '(pretty-vimgrep)--heading[show matches grouped by file name]' 131 | "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]" 132 | 133 | + '(hidden)' # Hidden-file options 134 | {-.,--hidden}'[search hidden files and directories]' 135 | $no"--no-hidden[don't search hidden files and directories]" 136 | 137 | + '(hybrid)' # hybrid regex options 138 | '--auto-hybrid-regex[DEPRECATED: dynamically use PCRE2 if necessary]' 139 | $no"--no-auto-hybrid-regex[DEPRECATED: don't dynamically use PCRE2 if necessary]" 140 | 141 | + '(ignore)' # Ignore-file options 142 | "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]" 143 | $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]' 144 | 145 | + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options 146 | '--ignore-file-case-insensitive[process ignore files case insensitively]' 147 | $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]' 148 | 149 | + '(ignore-exclude)' # Local exclude (ignore)-file options 150 | "--no-ignore-exclude[don't respect local exclude (ignore) files]" 151 | $no'--ignore-exclude[respect local exclude (ignore) files]' 152 | 153 | + '(ignore-global)' # Global ignore-file options 154 | "--no-ignore-global[don't respect global ignore files]" 155 | $no'--ignore-global[respect global ignore files]' 156 | 157 | + '(ignore-parent)' # Parent ignore-file options 158 | "--no-ignore-parent[don't respect ignore files in parent directories]" 159 | $no'--ignore-parent[respect ignore files in parent directories]' 160 | 161 | + '(ignore-vcs)' # VCS ignore-file options 162 | "--no-ignore-vcs[don't respect version control ignore files]" 163 | $no'--ignore-vcs[respect version control ignore files]' 164 | 165 | + '(require-git)' # git specific settings 166 | "--no-require-git[don't require git repository to respect gitignore rules]" 167 | $no'--require-git[require git repository to respect gitignore rules]' 168 | 169 | + '(ignore-dot)' # .ignore options 170 | "--no-ignore-dot[don't respect .ignore files]" 171 | $no'--ignore-dot[respect .ignore files]' 172 | 173 | + '(ignore-files)' # custom global ignore file options 174 | "--no-ignore-files[don't respect --ignore-file flags]" 175 | $no'--ignore-files[respect --ignore-file files]' 176 | 177 | + '(json)' # JSON options 178 | '--json[output results in JSON Lines format]' 179 | $no"--no-json[don't output results in JSON Lines format]" 180 | 181 | + '(line-number)' # Line-number options 182 | {-n,--line-number}'[show line numbers for matches]' 183 | {-N,--no-line-number}"[don't show line numbers for matches]" 184 | 185 | + '(line-terminator)' # Line-terminator options 186 | '--crlf[use CRLF as line terminator]' 187 | $no"--no-crlf[don't use CRLF as line terminator]" 188 | '(text)--null-data[use NUL as line terminator]' 189 | 190 | + '(max-columns-preview)' # max column preview options 191 | '--max-columns-preview[show preview for long lines (with -M)]' 192 | $no"--no-max-columns-preview[don't show preview for long lines (with -M)]" 193 | 194 | + '(max-depth)' # Directory-depth options 195 | {-d,--max-depth}'[specify max number of directories to descend]:number of directories' 196 | '--maxdepth=[alias for --max-depth]:number of directories' 197 | '!--maxdepth=:number of directories' 198 | 199 | + '(messages)' # Error-message options 200 | '(--no-ignore-messages)--no-messages[suppress some error messages]' 201 | $no"--messages[don't suppress error messages affected by --no-messages]" 202 | 203 | + '(messages-ignore)' # Ignore-error message options 204 | "--no-ignore-messages[don't show ignore-file parse error messages]" 205 | $no'--ignore-messages[show ignore-file parse error messages]' 206 | 207 | + '(mmap)' # mmap options 208 | '--mmap[search using memory maps when possible]' 209 | "--no-mmap[don't search using memory maps]" 210 | 211 | + '(multiline)' # Multiline options 212 | {-U,--multiline}'[permit matching across multiple lines]' 213 | $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]' 214 | 215 | + '(multiline-dotall)' # Multiline DOTALL options 216 | '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]' 217 | $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]" 218 | 219 | + '(only)' # Only-match options 220 | {-o,--only-matching}'[show only matching part of each line]' 221 | 222 | + '(passthru)' # Pass-through options 223 | '(--vimgrep)--passthru[show both matching and non-matching lines]' 224 | '(--vimgrep)--passthrough[alias for --passthru]' 225 | 226 | + '(pcre2)' # PCRE2 options 227 | {-P,--pcre2}'[enable matching with PCRE2]' 228 | $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]' 229 | 230 | + '(pcre2-unicode)' # PCRE2 Unicode options 231 | $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[DEPRECATED: enable PCRE2 Unicode mode (with -P)]' 232 | '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[DEPRECATED: disable PCRE2 Unicode mode (with -P)]' 233 | 234 | + '(pre)' # Preprocessing options 235 | '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e' 236 | $no'--no-pre[disable preprocessor utility]' 237 | 238 | + pre-glob # Preprocessing glob options 239 | '*--pre-glob[include/exclude files for preprocessing with --pre]' 240 | 241 | + '(pretty-vimgrep)' # Pretty/vimgrep display options 242 | '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]' 243 | '(heading passthru)--vimgrep[show results in vim-compatible format]' 244 | 245 | + regexp # Explicit pattern options 246 | '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern' 247 | 248 | + '(replace)' # Replacement options 249 | {-r+,--replace=}'[specify string used to replace matches]:replace string' 250 | 251 | + '(sort)' # File-sorting options 252 | '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:(( 253 | none\:"no sorting" 254 | path\:"sort by file path" 255 | modified\:"sort by last modified time" 256 | accessed\:"sort by last accessed time" 257 | created\:"sort by creation time" 258 | ))' 259 | '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:(( 260 | none\:"no sorting" 261 | path\:"sort by file path" 262 | modified\:"sort by last modified time" 263 | accessed\:"sort by last accessed time" 264 | created\:"sort by creation time" 265 | ))' 266 | '(threads)--sort-files[DEPRECATED: sort results by file path (disables parallelism)]' 267 | $no"--no-sort-files[DEPRECATED: do not sort results]" 268 | 269 | + '(stats)' # Statistics options 270 | '(--files file-match)--stats[show search statistics]' 271 | $no"--no-stats[don't show search statistics]" 272 | 273 | + '(text)' # Binary-search options 274 | {-a,--text}'[search binary files as if they were text]' 275 | "--binary[search binary files, don't print binary data]" 276 | $no"--no-binary[don't search binary files]" 277 | $no"(--null-data)--no-text[don't search binary files as if they were text]" 278 | 279 | + '(threads)' # Thread-count options 280 | '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads' 281 | 282 | + '(trim)' # Trim options 283 | '--trim[trim any ASCII whitespace prefix from each line]' 284 | $no"--no-trim[don't trim ASCII whitespace prefix from each line]" 285 | 286 | + type # Type options 287 | '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types' 288 | '*--type-add=[add new glob for specified file type]: :->typespec' 289 | '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types' 290 | # This should actually be exclusive with everything but other type options 291 | '(: *)--type-list[show all supported file types and their associated globs]' 292 | '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types" 293 | 294 | + '(word-line)' # Whole-word/line match options 295 | {-w,--word-regexp}'[only show matches surrounded by word boundaries]' 296 | {-x,--line-regexp}'[only show matches surrounded by line boundaries]' 297 | 298 | + '(unicode)' # Unicode options 299 | $no'--unicode[enable Unicode mode]' 300 | '--no-unicode[disable Unicode mode]' 301 | 302 | + '(zip)' # Compression options 303 | '(--pre)'{-z,--search-zip}'[search in compressed files]' 304 | $no"--no-search-zip[don't search in compressed files]" 305 | 306 | + misc # Other options — no need to separate these at the moment 307 | '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]' 308 | $no"--no-byte-offset[don't show byte offsets for each matching line]" 309 | '--color=[specify when to use colors in output]:when:(( 310 | never\:"never use colors" 311 | auto\:"use colors or not based on stdout, TERM, etc." 312 | always\:"always use colors" 313 | ansi\:"always use ANSI colors (even on Windows)" 314 | ))' 315 | '*--colors=[specify color and style settings]: :->colorspec' 316 | '--context-separator=[specify string used to separate non-continuous context lines in output]:separator' 317 | $no"--no-context-separator[don't print context separators]" 318 | '--debug[show debug messages]' 319 | '--field-context-separator[set string to delimit fields in context lines]' 320 | '--field-match-separator[set string to delimit fields in matching lines]' 321 | '--hostname-bin=[executable for getting system hostname]:hostname executable:_command_names -e' 322 | '--hyperlink-format=[specify pattern for hyperlinks]:pattern' 323 | '--trace[show more verbose debug messages]' 324 | '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)' 325 | "(1 stats)--files[show each file that would be searched (but don't search)]" 326 | '*--ignore-file=[specify additional ignore file]:ignore file:_files' 327 | '(-v --invert-match)'{-v,--invert-match}'[invert matching]' 328 | $no"--no-invert-match[do not invert matching]" 329 | '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes' 330 | '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches' 331 | '--max-filesize=[specify size above which files should be ignored]:file size (bytes)' 332 | "--no-config[don't load configuration files]" 333 | '(-0 --null)'{-0,--null}'[print NUL byte after file names]' 334 | '--path-separator=[specify path separator to use when printing file names]:separator' 335 | '(-q --quiet)'{-q,--quiet}'[suppress normal output]' 336 | '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)' 337 | '*'{-u,--unrestricted}'[reduce level of "smart" searching]' 338 | '--stop-on-nonmatch[stop on first non-matching line after a matching one]' 339 | 340 | + operand # Operands 341 | '(--files --type-list file regexp)1: :_guard "^-*" pattern' 342 | '(--type-list)*: :_files' 343 | ) 344 | 345 | # This is used with test-complete to verify that there are no options 346 | # listed in the help output that aren't also defined here 347 | [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && { 348 | print -rl - $args 349 | return 0 350 | } 351 | 352 | # Strip out argument groups where unsupported (see above) 353 | [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] && 354 | args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} ) 355 | 356 | _arguments -C -s -S : $args && ret=0 357 | 358 | case $state in 359 | colorspec) 360 | if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then 361 | suf=( -qS: ) 362 | tmp=( 363 | 'column:specify coloring for column numbers' 364 | 'line:specify coloring for line numbers' 365 | 'match:specify coloring for match text' 366 | 'path:specify coloring for file names' 367 | ) 368 | descr='color/style type' 369 | elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then 370 | suf=( -qS: ) 371 | tmp=( 372 | 'none:clear color/style for type' 373 | 'bg:specify background color' 374 | 'fg:specify foreground color' 375 | 'style:specify text style' 376 | ) 377 | descr='color/style attribute' 378 | elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then 379 | tmp=( black blue green red cyan magenta yellow white ) 380 | descr='color name or r,g,b' 381 | elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then 382 | tmp=( {,no}bold {,no}intense {,no}underline ) 383 | descr='style name' 384 | else 385 | _message -e colorspec 'no more arguments' 386 | fi 387 | 388 | (( $#tmp )) && { 389 | compset -P '*:' 390 | _describe -t colorspec $descr tmp $suf && ret=0 391 | } 392 | ;; 393 | 394 | typespec) 395 | if compset -P '[^:]##:include:'; then 396 | _sequence -s , _rg_types && ret=0 397 | # @todo This bit in particular could be better, but it's a little 398 | # complex, and attempting to solve it seems to run us up against a crash 399 | # bug — zsh # 40362 400 | elif compset -P '[^:]##:'; then 401 | _message 'glob or include directive' && ret=1 402 | elif [[ ! -prefix *:* ]]; then 403 | _rg_types -qS : && ret=0 404 | fi 405 | ;; 406 | esac 407 | 408 | return ret 409 | } 410 | 411 | # Complete encodings 412 | _rg_encodings() { 413 | local -a expl 414 | local -aU _encodings 415 | 416 | _encodings=( 417 | # This is impossible to read, but these encodings rarely if ever change, so 418 | # it probably does not matter. They are derived from the list given here: 419 | # https://encoding.spec.whatwg.org/#concept-encoding-get 420 | # 421 | # The globbing here works in both fish and zsh (though they expand it in 422 | # different orders). It may work in other shells too. 423 | 424 | {{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean} 425 | logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian} 426 | 866 ibm{819,866} csibm866 427 | big5{,-hkscs} {cn-,cs}big5 x-x-big5 428 | cp{819,866,125{0,1,2,3,4,5,6,7,8}} x-cp125{0,1,2,3,4,5,6,7,8} 429 | csiso2022{jp,kr} csiso8859{6,8}{e,i} 430 | csisolatin{1,2,3,4,5,6,9} csisolatin{arabic,cyrillic,greek,hebrew} 431 | ecma-{114,118} asmo-708 elot_928 sun_eu_greek 432 | euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese 433 | {,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312 434 | iso-2022-{cn,cn-ext,jp,kr} 435 | iso8859{,-}{1,2,3,4,5,6,7,8,9,10,11,13,14,15} 436 | iso-8859-{1,2,3,4,5,6,7,8,9,10,11,{6,8}-{e,i},13,14,15,16} iso_8859-{1,2,3,4,5,6,7,8,9,15} 437 | iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989 438 | iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157} 439 | koi{,8,8-r,8-ru,8-u,8_r} cskoi8r 440 | ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987 441 | latin{1,2,3,4,5,6} l{1,2,3,4,5,6,9} 442 | shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 443 | utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 444 | windows-{31j,874,949,125{0,1,2,3,4,5,6,7,8}} dos-874 tis-620 ansi_x3.4-1968 445 | x-user-defined auto none 446 | ) 447 | 448 | _wanted encodings expl encoding compadd -a "$@" - _encodings 449 | } 450 | 451 | # Complete file types 452 | _rg_types() { 453 | local -a expl 454 | local -aU _types 455 | 456 | _types=( ${(@)${(f)"$( _call_program types $words[1] --type-list )"}//:[[:space:]]##/:} ) 457 | 458 | if zstyle -t ":completion:${curcontext}:types" extra-verbose; then 459 | _describe -t types 'file type' _types 460 | else 461 | _wanted types expl 'file type' compadd "$@" - ${(@)_types%%:*} 462 | fi 463 | } 464 | 465 | _rg "$@" 466 | 467 | ################################################################################ 468 | # ZSH COMPLETION REFERENCE 469 | # 470 | # For the convenience of developers who aren't especially familiar with zsh 471 | # completion functions, a brief reference guide follows. This is in no way 472 | # comprehensive; it covers just enough of the basic structure, syntax, and 473 | # conventions to help someone make simple changes like adding new options. For 474 | # more complete documentation regarding zsh completion functions, please see the 475 | # following: 476 | # 477 | # * http://zsh.sourceforge.net/Doc/Release/Completion-System.html 478 | # * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide 479 | # 480 | # OVERVIEW 481 | # 482 | # Most zsh completion functions are defined in terms of `_arguments`, which is a 483 | # shell function that takes a series of argument specifications. The specs for 484 | # `rg` are stored in an array, which is common for more complex functions; the 485 | # elements of the array are passed to `_arguments` on invocation. 486 | # 487 | # ARGUMENT-SPECIFICATION SYNTAX 488 | # 489 | # The following is a contrived example of the argument specs for a simple tool: 490 | # 491 | # '(: * -)'{-h,--help}'[display help information]' 492 | # '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]' 493 | # '!(-q -v --quiet --verbose)--silent' 494 | # '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]' 495 | # '--color=[specify when to use colors]:when:(always never auto)' 496 | # '*:example file:_files' 497 | # 498 | # Although there may appear to be six specs here, there are actually nine; we 499 | # use brace expansion to combine specs for options that go by multiple names, 500 | # like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh 501 | # merges completion possibilities together when they have the same description. 502 | # 503 | # The first line defines the option `-h`/`--help`. With most tools, it isn't 504 | # useful to complete anything after `--help` because it effectively overrides 505 | # all others; the `(: * -)` at the beginning of the spec tells zsh not to 506 | # complete any other operands (`:` and `*`) or options (`-`) after this one has 507 | # been used. The `[...]` at the end associates a description with `-h`/`--help`; 508 | # as mentioned, zsh will see the identical descriptions and merge these options 509 | # together when offering completion possibilities. 510 | # 511 | # The next line defines `-q`/`--quiet`. Here we don't want to suppress further 512 | # completions entirely, but we don't want to offer `-q` if `--quiet` has been 513 | # given (since they do the same thing), nor do we want to offer `-v` (since it 514 | # doesn't make sense to be quiet and verbose at the same time). We don't need to 515 | # tell zsh not to offer `--quiet` a second time, since that's the default 516 | # behaviour, but since this line expands to two specs describing `-q` *and* 517 | # `--quiet` we do need to explicitly list all of them here. 518 | # 519 | # The next line defines a hidden option `--silent` — maybe it's a deprecated 520 | # synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this 521 | # option during completion. The benefit of providing a spec for an option that 522 | # shouldn't be completed is that, if someone *does* use it, we can correctly 523 | # suppress completion of other options afterwards. 524 | # 525 | # The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`. 526 | # 527 | # The next line defines `--color`. In this example, `--color` doesn't have a 528 | # corresponding short option, so we don't need to use brace expansion. Further, 529 | # there are no other options it's exclusive with (just itself), so we don't need 530 | # to define those at the beginning. However, it does take a mandatory argument. 531 | # The `=` at the end of `--color=` indicates that the argument may appear either 532 | # like `--color always` or like `--color=always`; this is how most GNU-style 533 | # command-line tools work. The corresponding short option would normally use `+` 534 | # — for example, `-c+` would allow either `-c always` or `-calways`. For this 535 | # option, the arguments are known ahead of time, so we can simply list them in 536 | # parentheses at the end (`when` is used as the description for the argument). 537 | # 538 | # The last line defines an operand (a non-option argument). In this example, the 539 | # operand can be used any number of times (the leading `*`), and it should be a 540 | # file path, so we tell zsh to call the `_files` function to complete it. The 541 | # `example file` in the middle is the description to use for this operand; we 542 | # could use a space instead to accept the default provided by `_files`. 543 | # 544 | # GROUPING ARGUMENT SPECIFICATIONS 545 | # 546 | # Newer versions of zsh support grouping argument specs together. All specs 547 | # following a `+` and then a group name are considered to be members of the 548 | # named group. Grouping is useful mostly for organisational purposes; it makes 549 | # the relationship between different options more obvious, and makes it easier 550 | # to specify exclusions. 551 | # 552 | # We could rewrite our example above using grouping as follows: 553 | # 554 | # '(: * -)'{-h,--help}'[display help information]' 555 | # '--color=[specify when to use colors]:when:(always never auto)' 556 | # '*:example file:_files' 557 | # + '(verbosity)' 558 | # {-q,--quiet}'[decrease output verbosity]' 559 | # '!--silent' 560 | # {-v,--verbose}'[increase output verbosity]' 561 | # 562 | # Here we take advantage of a useful feature of spec grouping — when the group 563 | # name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all 564 | # of the options in that group are exclusive with each other. As a result, we 565 | # don't need to manually list out the exclusions at the beginning of each 566 | # option. 567 | # 568 | # Groups can also be referred to by name in other argument specs; for example: 569 | # 570 | # '(xyz)--aaa' '*: :_files' 571 | # + xyz --xxx --yyy --zzz 572 | # 573 | # Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and 574 | # `--zzz` are not to be completed after `--aaa`. This makes the exclusion list 575 | # much more compact and reusable. 576 | # 577 | # CONVENTIONS 578 | # 579 | # zsh completion functions generally adhere to the following conventions: 580 | # 581 | # * Use two spaces for indentation 582 | # * Combine specs for options with different names using brace expansion 583 | # * In combined specs, list the short option first (as in `{-a,--text}`) 584 | # * Use `+` or `=` as described above for options that take arguments 585 | # * Provide a description for all options, option-arguments, and operands 586 | # * Capitalise/punctuate argument descriptions as phrases, not complete 587 | # sentences — 'display help information', never 'Display help information.' 588 | # (but still capitalise acronyms and proper names) 589 | # * Write argument descriptions as verb phrases — 'display x', 'enable y', 590 | # 'use z' 591 | # * Word descriptions to make it clear when an option expects an argument; 592 | # usually this is done with the word 'specify', as in 'specify x' or 593 | # 'use specified x') 594 | # * Write argument descriptions as tersely as possible — for example, articles 595 | # like 'a' and 'the' should be omitted unless it would be confusing 596 | # 597 | # Other conventions currently used by this function: 598 | # 599 | # * Order argument specs alphabetically by group name, then option name 600 | # * Group options that are directly related, mutually exclusive, or frequently 601 | # referenced by other argument specs 602 | # * Use only characters in the set [a-z0-9_-] in group names 603 | # * Order exclusion lists as follows: short options, long options, groups 604 | # * Use American English in descriptions 605 | # * Use 'don't' in descriptions instead of 'do not' 606 | # * Word descriptions for related options as similarly as possible. For example, 607 | # `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and 608 | # `--no-foo[don't use foo]` 609 | # * Word descriptions to make it clear when an option only makes sense with 610 | # another option, usually by adding '(with -x)' to the end 611 | # * Don't quote strings or variables unnecessarily. When quotes are required, 612 | # prefer single-quotes to double-quotes 613 | # * Prefix option specs with `$no` when the option serves only to negate the 614 | # behaviour of another option that must be provided explicitly by the user. 615 | # This prevents rarely used options from cluttering up the completion menu 616 | ################################################################################ 617 | 618 | # ------------------------------------------------------------------------------ 619 | # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users 620 | # All rights reserved. 621 | # 622 | # Redistribution and use in source and binary forms, with or without 623 | # modification, are permitted provided that the following conditions are met: 624 | # * Redistributions of source code must retain the above copyright 625 | # notice, this list of conditions and the following disclaimer. 626 | # * Redistributions in binary form must reproduce the above copyright 627 | # notice, this list of conditions and the following disclaimer in the 628 | # documentation and/or other materials provided with the distribution. 629 | # * Neither the name of the zsh-users nor the 630 | # names of its contributors may be used to endorse or promote products 631 | # derived from this software without specific prior written permission. 632 | # 633 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 634 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 635 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 636 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 637 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 638 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 639 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 640 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 641 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 642 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 643 | # ------------------------------------------------------------------------------ 644 | # Description 645 | # ----------- 646 | # 647 | # Completion script for ripgrep 648 | # 649 | # ------------------------------------------------------------------------------ 650 | # Authors 651 | # ------- 652 | # 653 | # * arcizan 654 | # * MaskRay 655 | # 656 | # ------------------------------------------------------------------------------ 657 | 658 | # Local Variables: 659 | # mode: shell-script 660 | # coding: utf-8-unix 661 | # indent-tabs-mode: nil 662 | # sh-indentation: 2 663 | # sh-basic-offset: 2 664 | # End: 665 | # vim: ft=zsh sw=2 ts=2 et 666 | -------------------------------------------------------------------------------- /src/custom/_rip: -------------------------------------------------------------------------------- 1 | #compdef rip 2 | 3 | # zsh completions for 'rip' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-d,--decompose}'[permanently deletes (unlink) the entire graveyard]' 9 | {-h,--help}'[prints help information]' 10 | {-i,--inspect}'[prints some info about TARGET before prompting for action]' 11 | {-s,--seance}'[prints files that were sent under the current directory]' 12 | {-V,--version}'[prints version information]' 13 | '--graveyard[directory where deleted files go to rest]' 14 | {-u,--unbury}'[undo the last removal by the current user, or specify some file(s) in the graveyard.]' 15 | '*:filename:_files' 16 | ) 17 | 18 | _arguments -s $arguments 19 | -------------------------------------------------------------------------------- /src/custom/_rust-analyzer: -------------------------------------------------------------------------------- 1 | #compdef rust-analyzer 2 | 3 | # zsh completions for 'rust-analyzer' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-v,--verbose}'[verbosity level, can be repeated multiple times.]' 9 | {-q,--quiet}'[verbosity level.]' 10 | '--log-file[log to the specified file instead of stderr.]' 11 | '--no-log-buffering[flush log records to the file immediately.]' 12 | '--wait-dbg[\[Unstable\] Wait until a debugger is attached to (requires debug build).]' 13 | {-h,--help}'[prints help information.]' 14 | {-V,--version}'[print version.]' 15 | '--print-config-schema[dump a LSP config JSON schema.]' 16 | '--no-dump[suppress printing.]' 17 | '--rainbow[enable rainbow highlighting of identifiers.]' 18 | '--output[]' 19 | '--randomize[randomize order in which crates, modules, and items are processed.]' 20 | '--parallel[run type inference in parallel.]' 21 | {-o,--only}'[only analyze items matching this path.]' 22 | '--with-deps[also analyze all dependencies.]' 23 | '--no-sysroot[dont load sysroot crates (`std`, `core` & friends).]' 24 | '--no-test[dont set #\[cfg(test)\].]' 25 | '--disable-build-scripts[dont run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.]' 26 | '--disable-proc-macros[dont use expand proc macros.]' 27 | '--proc-macro-srv[run the proc-macro-srv binary at the specified path.]' 28 | '--skip-lowering[skip body lowering.]' 29 | '--skip-inference[skip type inference.]' 30 | '--skip-mir-stats[skip lowering to mir]' 31 | '--skip-data-layout[skip data layout calculation]' 32 | '--skip-const-eval[skip const evaluation]' 33 | '--run-all-ide-things[runs several IDE features after analysis, including semantics highlighting, diagnostics]' 34 | '--run-term-search[run term search on all the tail expressions (of functions, block, if statements etc.)]' 35 | '--validate-term-search[validate term search by running `cargo check` on every response.]' 36 | '--filter[only run tests with filter as substring]' 37 | '--disable-build-scripts[dont run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.]' 38 | '--disable-proc-macros[dont use expand proc macros.]' 39 | '--proc-macro-srv[run the proc-macro-srv binary at the specified path.]' 40 | '--disable-build-scripts[dont run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.]' 41 | '--disable-proc-macros[dont use expand proc macros.]' 42 | '--proc-macro-srv[run the proc-macro-srv binary at the specified path.]' 43 | '--debug[prints debug information for any nodes with source exactly equal to snippet.]' 44 | '--exclude-vendored-libraries[exclude code from vendored libraries from the resulting index.]' 45 | '--output[the output path where the SCIP file will be written to. Defaults to `index.scip`.]' 46 | '--config-path[A path to an json configuration file that can be used to customize cargo behavior.]' 47 | '--exclude-vendored-libraries[exclude code from vendored libraries from the resulting index.]' 48 | '*:filename:_files' 49 | ) 50 | 51 | _arguments -s $arguments 52 | -------------------------------------------------------------------------------- /src/custom/_rust-gdb: -------------------------------------------------------------------------------- 1 | #compdef rust-gdb 2 | 3 | # zsh completions for 'rust-gdb' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | '--args[arguments after executable-file are passed to inferior.]' 9 | '--core[analyze the core dump COREFILE.]' 10 | '--exec[use EXECFILE as the executable.]' 11 | '--pid[attach to running process PID.]' 12 | '--directory[search for source files in DIR.]' 13 | '--se[use FILE as symbol file and executable file.]' 14 | '--symbols[read symbols from SYMFILE.]' 15 | '--readnow[fully read symbol files on first access.]' 16 | '--readnever[do not read symbol files.]' 17 | '--write[set writing into executable and core files.]' 18 | {--command,-x}'[GDB commands from FILE.]' 19 | {--init-command,-ix}'[like -x but execute commands before loading inferior.]' 20 | {--eval-command,-ex}'[execute a single GDB command.]' 21 | {--init-eval-command,-iex}'[like -ex but before loading inferior.]' 22 | '--nh[do not read ~/.gdbinit.]' 23 | '--nx[do not read any .gdbinit files in any directory.]' 24 | '--fullname[output information used by emacs-GDB interface.]' 25 | '--interpreter[select a specific interpreter / user interface.]' 26 | '--tty[use TTY for input/output by the program being debugged.]' 27 | '-w[use the GUI interface.]' 28 | '--nw[do not use the GUI interface.]' 29 | '--tui[use a terminal user interface.]' 30 | {-q,--quiet,--silent}'[do not print version number on startup.]' 31 | '--batch[exit after processing options.]' 32 | '--batch-silent[like --batch, but suppress all gdb stdout output.]' 33 | '--return-child-result[GDB exit code will be the childs exit code.]' 34 | '--configuration[print details about GDB configuration and then exit.]' 35 | '--help[print this message and then exit.]' 36 | '--version[print version information and then exit.]' 37 | '-b[set serial port baud rate used for remote debugging.]' 38 | '-l[set timeout in seconds for remote debugging.]' 39 | '--cd[change current directory to DIR.]' 40 | {--data-directory,-D}'[set GDBs data-directory to DIR.]' 41 | '*:filename:_files' 42 | ) 43 | 44 | _arguments -s $arguments 45 | -------------------------------------------------------------------------------- /src/custom/_rust-lldb: -------------------------------------------------------------------------------- 1 | #compdef rust-lldb 2 | 3 | # zsh completions for 'rust-lldb' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | '--attach-name[tells the debugger to attach to a process with the given name.]' 9 | '--attach-pid[tells the debugger to attach to a process with the given pid.]' 10 | '-n[alias for --attach-name]' 11 | '-p[alias for --attach-pid]' 12 | '--wait-for[tells the debugger to wait for a process with the given pid or name to launch before attaching.]' 13 | '-w[alias for --wait-for]' 14 | '--batch[tells the debugger to run the commands from -s, -S, -o & -O, and then quit.]' 15 | '-b[alias for --batch]' 16 | '-K[alias for --source-on-crash]' 17 | '-k[alias for --one-line-on-crash]' 18 | '--local-lldbinit[allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.]' 19 | '--no-lldbinit[do not automatically parse any .lldbinit files.]' 20 | '--one-line-before-file[tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.]' 21 | '--one-line-on-crash[when in batch mode, tells the debugger to run this one-line lldb command if the target crashes.]' 22 | '--one-line[tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.]' 23 | '-O[alias for --one-line-before-file]' 24 | '-o[alias for --one-line]' 25 | '-Q[alias for --source-quietly]' 26 | '--source-before-file[tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.]' 27 | '--source-on-crash[when in batch mode, tells the debugger to source this file of lldb commands if the target crashes.]' 28 | '--source-quietly[tells the debugger not to echo commands while sourcing files or one-line commands provided on the command line.]' 29 | '--source[tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.]' 30 | '-S[alias for --source-before-file]' 31 | '-s[alias for --source]' 32 | '-x[alias for --no-lldbinit]' 33 | '--arch[tells the debugger to use the specified architecture when starting and running the program.]' 34 | '-a[alias for --arch]' 35 | '--core[tells the debugger to use the full path to as the core file.]' 36 | '-c[alias for --core]' 37 | '--debug[tells the debugger to print out extra information for debugging itself.]' 38 | '-d[alias for --debug]' 39 | '--editor[tells the debugger to open source files using the hosts "external editor" mechanism.]' 40 | '-e[alias for --editor]' 41 | '--file[tells the debugger to use the file as the program to be debugged.]' 42 | '-f[alias for --file]' 43 | '--help[prints out the usage information for the LLDB debugger.]' 44 | '-h[alias for --help]' 45 | '--no-use-colors[do not use colors.]' 46 | '--version[prints out the current version number of the LLDB debugger.]' 47 | '-v[alias for --version]' 48 | '-X[alias for --no-use-color]' 49 | '-r[alias for --repl=]' 50 | '--repl-language[chooses the language for the REPL.]' 51 | '--repl[runs lldb in REPL mode with a stub process with the given flags.]' 52 | '--repl[runs lldb in REPL mode with a stub process.]' 53 | '-R[alias for --repl-language]' 54 | '-r[alias for --repl]' 55 | '-l[alias for --script-language]' 56 | '--print-script-interpreter-info[prints out a json dictionary with information about the scripting language interpreter.]' 57 | '--python-path[out the path to the lldb.py file for this version of lldb.]' 58 | '-P[alias for --python-path]' 59 | '--script-language[tells the debugger to use the specified scripting language for user-defined scripts.]' 60 | '*:filename:_files' 61 | ) 62 | 63 | _arguments -s $arguments 64 | -------------------------------------------------------------------------------- /src/custom/_rustc: -------------------------------------------------------------------------------- 1 | #compdef rustc 2 | 3 | # zsh completions for 'rustc' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-h,--help}'[display this message]' 9 | '--cfg[configure the compilation environment.]' 10 | '--check-cfg[provide list of expected cfgs for checking]' 11 | '-L[\]PATH Add a directory to the library search path. The]' 12 | '-l[\]NAME\[:RENAME\]]' 13 | '--crate-type[comma separated list of types of crates]' 14 | '--crate-name[specify the name of the crate being built]' 15 | '--edition[015|2018|2021|2024]' 16 | '--emit[comma separated list of types of output for the]' 17 | '--print[compiler information to print on stdout]' 18 | '-g[equivalent to -C debuginfo=2]' 19 | '-O[equivalent to -C opt-level=3]' 20 | '-o[write output to ]' 21 | '--out-dir[write output to compiler-chosen filename in ]' 22 | '--explain[provide a detailed explanation of an error message]' 23 | '--test[build a test harness]' 24 | '--target[target triple for which the code is compiled]' 25 | {-A,--allow}'[set lint allowed]' 26 | {-W,--warn}'[set lint warnings]' 27 | '--force-warn[set lint force-warn]' 28 | {-D,--deny}'[set lint denied]' 29 | {-F,--forbid}'[set lint forbidden]' 30 | '--cap-lints[set the most restrictive lint level. More restrictive]' 31 | {-C,--codegen}'[VALUE\]]' 32 | {-V,--version}'[print version info and exit]' 33 | {-v,--verbose}'[use verbose output]' 34 | '-C[print codegen options]' 35 | '-W[print lint options and default settings]' 36 | {--help,-v}'[print the full set of options rustc accepts]' 37 | '*:filename:_files' 38 | ) 39 | 40 | _arguments -s $arguments 41 | -------------------------------------------------------------------------------- /src/custom/_rustdoc: -------------------------------------------------------------------------------- 1 | #compdef rustdoc 2 | 3 | # zsh completions for 'rustdoc' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-h,--help}'[show this help message]' 9 | {-V,--version}'[print rustdocs version]' 10 | {-v,--verbose}'[use verbose output]' 11 | {-w,--output-format}'[the output type to write]' 12 | '--output[which directory to place the output. This option is]' 13 | {-o,--out-dir}'[which directory to place the output]' 14 | '--crate-name[specify the name of this crate]' 15 | '--crate-type[comma separated list of types of crates]' 16 | {-L,--library-path}'[directory to add to crate search path]' 17 | '--cfg[pass a --cfg to rustc]' 18 | '--check-cfg[pass a --check-cfg to rustc]' 19 | '--extern[PATH\]]' 20 | '--extern-html-root-url[URL]' 21 | '--extern-html-root-takes-precedence[give precedence to `--extern-html-root-url`, not]' 22 | {-C,--codegen}'[VALUE\]]' 23 | '--document-private-items[document private items]' 24 | '--document-hidden-items[document items that have doc(hidden)]' 25 | '--test[run code examples as tests]' 26 | '--test-args[arguments to pass to the test runner]' 27 | '--test-run-directory[the working directory in which to run tests]' 28 | '--target[target triple to document]' 29 | '--markdown-css[CSS files to include via in a rendered Markdown]' 30 | '--html-in-header[files to include inline in the section of a]' 31 | '--html-before-content[files to include inline between and the content]' 32 | '--html-after-content[files to include inline between the content and]' 33 | '--markdown-before-content[files to include inline between and the content]' 34 | '--markdown-after-content[files to include inline between the content and]' 35 | '--markdown-playground-url[URL to send code snippets to]' 36 | '--markdown-no-toc[dont include table of contents]' 37 | {-e,--extend-css}'[to add some CSS rules with a given file to generate]' 38 | '-Z[unstable / perma-unstable options (only on nightly]' 39 | '--sysroot[override the system root]' 40 | '--playground-url[URL to send code snippets to, may be reset by]' 41 | '--markdown-playground-url[`#!\[doc(html_playground_url=...)\]`]' 42 | '--display-doctest-warnings[show warnings that originate in doctests]' 43 | '--crate-version[crate version to print into documentation]' 44 | '--sort-modules-by-appearance[sort modules by where they appear in the program]' 45 | '--default-theme[set the default theme. THEME should be the theme name]' 46 | '--default-setting[VALUE\]]' 47 | '--theme[additional themes which will be added to the generated]' 48 | '--check-theme[check if given theme is valid]' 49 | '--resource-suffix[suffix to add to CSS and JavaScript files, e.g.]' 50 | '--edition[edition to use when compiling rust code (default:]' 51 | '--color[configure coloring of output:]' 52 | '--error-format[how errors and other messages are produced]' 53 | '--diagnostic-width[provide width of the output for truncated error]' 54 | '--json[configure the structure of JSON diagnostics]' 55 | {-A,--allow}'[set lint allowed]' 56 | {-W,--warn}'[set lint warnings]' 57 | '--force-warn[set lint force-warn]' 58 | {-D,--deny}'[set lint denied]' 59 | {-F,--forbid}'[set lint forbidden]' 60 | '--cap-lints[set the most restrictive lint level. More restrictive]' 61 | '--index-page[markdown file to be used as index page]' 62 | '--enable-index-page[to enable generation of the index page]' 63 | '--static-root-path[path string to force loading static files from in]' 64 | '--persist-doctests[directory to persist doctest executables into]' 65 | '--show-coverage[calculate percentage of public items with]' 66 | '--enable-per-target-ignores[parse ignore-foo for ignoring doctests on a per-target]' 67 | '--runtool[tool to run tests with when building for a different target than host]' 68 | '--runtool-arg[(of possibly many) arguments to pass to the runtool]' 69 | '--test-builder[the rustc-like binary to use as the test builder]' 70 | '--test-builder-wrapper[wrapper program to pass test-builder and arguments]' 71 | '--check[run rustdoc checks]' 72 | '--generate-redirect-map[generate JSON file at the top level instead of]' 73 | '--emit[toolchain-shared-resources,invocation-specific\]]' 74 | '--no-run[compile doctests without running them]' 75 | '--remap-path-prefix[TO]' 76 | '--show-type-layout[include the memory layout of types in the docs]' 77 | '--nocapture[dont capture stdout and stderr of tests]' 78 | '--generate-link-to-definition[make the identifiers in the HTML source code pages]' 79 | '--scrape-examples-output-path[function call information and output at the given path]' 80 | '--scrape-examples-target-crate[function call information for functions from the target crate]' 81 | '--scrape-tests[include test code when scraping examples]' 82 | '--with-examples[to function call information (for displaying examples in the documentation)]' 83 | '--merge[controls how rustdoc handles files from previously]' 84 | '--out-dir[shared = Append current crates info to files found in]' 85 | '--include-parts-dir[to the --out-dir, overwriting]' 86 | '--parts-out-dir[/to/doc.parts/]' 87 | '--merge[]' 88 | '--include-parts-dir[/to/doc.parts/]' 89 | '--html-no-source[disable HTML source code pages generation]' 90 | '--doctest-compilation-args[arguments to be used when compiling doctests]' 91 | '--disable-minification[disable the minification of CSS/JS files]' 92 | '--plugin-path[removed, see issue #44136]' 93 | '--passes[removed, see issue #44136]' 94 | '--plugins[removed, see issue #44136]' 95 | '--no-defaults[removed, see issue #44136]' 96 | {-r,--input-format}'[removed, see issue #44136]' 97 | '*:filename:_files' 98 | ) 99 | 100 | _arguments -s $arguments 101 | -------------------------------------------------------------------------------- /src/custom/_rustfmt: -------------------------------------------------------------------------------- 1 | #compdef rustfmt 2 | 3 | # zsh completions for 'rustfmt' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | '--check[run in check mode. Exits with 0 if input is]' 9 | '--emit[what data to emit and how]' 10 | '--backup[backup any modified files.]' 11 | '--config-path[for the configuration file\]]' 12 | '--edition[2015|2018|2021|2024\]]' 13 | '--color[use colored output (if supported)]' 14 | '--print-config[PATH]' 15 | {-l,--files-with-diff}'[prints the names of mismatched files that were]' 16 | '--config[1=val1,key2=val2...\]]' 17 | '--style-edition[2015|2018|2021|2024\]]' 18 | {-v,--verbose}'[print verbose output]' 19 | {-q,--quiet}'[print less output]' 20 | {-V,--version}'[show version information]' 21 | {-h,--help}'[TOPIC\] Show this message or help about a specific topic:]' 22 | '*:filename:_files' 23 | ) 24 | 25 | _arguments -s $arguments 26 | -------------------------------------------------------------------------------- /src/custom/_tldr: -------------------------------------------------------------------------------- 1 | #compdef tldr 2 | 3 | _applications() { 4 | local -a commands 5 | if commands=(${(uonzf)"$(tldr --list 2>/dev/null)"//:/\\:}); then 6 | _describe -t commands 'command' commands 7 | fi 8 | } 9 | 10 | _tealdeer() { 11 | local I="-h --help -v --version" 12 | integer ret=1 13 | local -a args 14 | 15 | args+=( 16 | "($I -l --list)"{-l,--list}"[List all commands in the cache]" 17 | "($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files" 18 | "($I -p --platform)"{-p,--platform}'[Override the operating system]:platform:(( 19 | linux 20 | macos 21 | sunos 22 | windows 23 | android 24 | freebsd 25 | netbsd 26 | openbsd 27 | ))' 28 | "($I -L --language)"{-L,--language}"[Override the language settings]:lang" 29 | "($I -u --update)"{-u,--update}"[Update the local cache]" 30 | "($I)--no-auto-update[If auto update is configured, disable it for this run]" 31 | "($I -c --clear-cache)"{-c,--clear-cache}"[Clear the local cache]" 32 | "($I)--pager[Use a pager to page output]" 33 | "($I -r --raw)"{-r,--raw}"[Display the raw markdown instead of rendering it]" 34 | "($I -q --quiet)"{-q,--quiet}"[Suppress informational messages]" 35 | "($I)--show-paths[Show file and directory paths used by tealdeer]" 36 | "($I)--seed-config[Create a basic config]" 37 | "($I)--color[Controls when to use color]:when:(( 38 | always 39 | auto 40 | never 41 | ))" 42 | '(- *)'{-h,--help}'[Display help]' 43 | '(- *)'{-v,--version}'[Show version information]' 44 | '1: :_applications' 45 | ) 46 | 47 | _arguments $args[@] && ret=0 48 | return ret 49 | } 50 | 51 | _tealdeer 52 | -------------------------------------------------------------------------------- /src/custom/_trpc-cli: -------------------------------------------------------------------------------- 1 | #compdef trpc-cli 2 | 3 | # zsh completion for trpc-cli -*- shell-script -*- 4 | 5 | __trpc-cli_debug() 6 | { 7 | local file="$BASH_COMP_DEBUG_FILE" 8 | if [[ -n ${file} ]]; then 9 | echo "$*" >> "${file}" 10 | fi 11 | } 12 | 13 | _trpc-cli() 14 | { 15 | local shellCompDirectiveError=1 16 | local shellCompDirectiveNoSpace=2 17 | local shellCompDirectiveNoFileComp=4 18 | local shellCompDirectiveFilterFileExt=8 19 | local shellCompDirectiveFilterDirs=16 20 | 21 | local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace 22 | local -a completions 23 | 24 | __trpc-cli_debug "\n========= starting completion logic ==========" 25 | __trpc-cli_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" 26 | 27 | # The user could have moved the cursor backwards on the command-line. 28 | # We need to trigger completion from the $CURRENT location, so we need 29 | # to truncate the command-line ($words) up to the $CURRENT location. 30 | # (We cannot use $CURSOR as its value does not work when a command is an alias.) 31 | words=("${=words[1,CURRENT]}") 32 | __trpc-cli_debug "Truncated words[*]: ${words[*]}," 33 | 34 | lastParam=${words[-1]} 35 | lastChar=${lastParam[-1]} 36 | __trpc-cli_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" 37 | 38 | # For zsh, when completing a flag with an = (e.g., trpc-cli -n=) 39 | # completions must be prefixed with the flag 40 | setopt local_options BASH_REMATCH 41 | if [[ "${lastParam}" =~ '-.*=' ]]; then 42 | # We are dealing with a flag with an = 43 | flagPrefix="-P ${BASH_REMATCH}" 44 | fi 45 | 46 | # Prepare the command to obtain completions 47 | requestComp="${words[1]} __complete ${words[2,-1]}" 48 | if [ "${lastChar}" = "" ]; then 49 | # If the last parameter is complete (there is a space following it) 50 | # We add an extra empty parameter so we can indicate this to the go completion code. 51 | __trpc-cli_debug "Adding extra empty parameter" 52 | requestComp="${requestComp} \"\"" 53 | fi 54 | 55 | __trpc-cli_debug "About to call: eval ${requestComp}" 56 | 57 | # Use eval to handle any environment variables and such 58 | out=$(eval ${requestComp} 2>/dev/null) 59 | __trpc-cli_debug "completion output: ${out}" 60 | 61 | # Extract the directive integer following a : from the last line 62 | local lastLine 63 | while IFS='\n' read -r line; do 64 | lastLine=${line} 65 | done < <(printf "%s\n" "${out[@]}") 66 | __trpc-cli_debug "last line: ${lastLine}" 67 | 68 | if [ "${lastLine[1]}" = : ]; then 69 | directive=${lastLine[2,-1]} 70 | # Remove the directive including the : and the newline 71 | local suffix 72 | (( suffix=${#lastLine}+2)) 73 | out=${out[1,-$suffix]} 74 | else 75 | # There is no directive specified. Leave $out as is. 76 | __trpc-cli_debug "No directive found. Setting do default" 77 | directive=0 78 | fi 79 | 80 | __trpc-cli_debug "directive: ${directive}" 81 | __trpc-cli_debug "completions: ${out}" 82 | __trpc-cli_debug "flagPrefix: ${flagPrefix}" 83 | 84 | if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then 85 | __trpc-cli_debug "Completion received error. Ignoring completions." 86 | return 87 | fi 88 | 89 | local activeHelpMarker="_activeHelp_ " 90 | local endIndex=${#activeHelpMarker} 91 | local startIndex=$((${#activeHelpMarker}+1)) 92 | local hasActiveHelp=0 93 | while IFS='\n' read -r comp; do 94 | # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) 95 | if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then 96 | __trpc-cli_debug "ActiveHelp found: $comp" 97 | comp="${comp[$startIndex,-1]}" 98 | if [ -n "$comp" ]; then 99 | compadd -x "${comp}" 100 | __trpc-cli_debug "ActiveHelp will need delimiter" 101 | hasActiveHelp=1 102 | fi 103 | 104 | continue 105 | fi 106 | 107 | if [ -n "$comp" ]; then 108 | # If requested, completions are returned with a description. 109 | # The description is preceded by a TAB character. 110 | # For zsh's _describe, we need to use a : instead of a TAB. 111 | # We first need to escape any : as part of the completion itself. 112 | comp=${comp//:/\\:} 113 | 114 | local tab="$(printf '\t')" 115 | comp=${comp//$tab/:} 116 | 117 | __trpc-cli_debug "Adding completion: ${comp}" 118 | completions+=${comp} 119 | lastComp=$comp 120 | fi 121 | done < <(printf "%s\n" "${out[@]}") 122 | 123 | # Add a delimiter after the activeHelp statements, but only if: 124 | # - there are completions following the activeHelp statements, or 125 | # - file completion will be performed (so there will be choices after the activeHelp) 126 | if [ $hasActiveHelp -eq 1 ]; then 127 | if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then 128 | __trpc-cli_debug "Adding activeHelp delimiter" 129 | compadd -x "--" 130 | hasActiveHelp=0 131 | fi 132 | fi 133 | 134 | if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then 135 | __trpc-cli_debug "Activating nospace." 136 | noSpace="-S ''" 137 | fi 138 | 139 | if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then 140 | # File extension filtering 141 | local filteringCmd 142 | filteringCmd='_files' 143 | for filter in ${completions[@]}; do 144 | if [ ${filter[1]} != '*' ]; then 145 | # zsh requires a glob pattern to do file filtering 146 | filter="\*.$filter" 147 | fi 148 | filteringCmd+=" -g $filter" 149 | done 150 | filteringCmd+=" ${flagPrefix}" 151 | 152 | __trpc-cli_debug "File filtering command: $filteringCmd" 153 | _arguments '*:filename:'"$filteringCmd" 154 | elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then 155 | # File completion for directories only 156 | local subdir 157 | subdir="${completions[1]}" 158 | if [ -n "$subdir" ]; then 159 | __trpc-cli_debug "Listing directories in $subdir" 160 | pushd "${subdir}" >/dev/null 2>&1 161 | else 162 | __trpc-cli_debug "Listing directories in ." 163 | fi 164 | 165 | local result 166 | _arguments '*:dirname:_files -/'" ${flagPrefix}" 167 | result=$? 168 | if [ -n "$subdir" ]; then 169 | popd >/dev/null 2>&1 170 | fi 171 | return $result 172 | else 173 | __trpc-cli_debug "Calling _describe" 174 | if eval _describe "completions" completions $flagPrefix $noSpace; then 175 | __trpc-cli_debug "_describe found some completions" 176 | 177 | # Return the success of having called _describe 178 | return 0 179 | else 180 | __trpc-cli_debug "_describe did not find completions." 181 | __trpc-cli_debug "Checking if we should do file completion." 182 | if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then 183 | __trpc-cli_debug "deactivating file completion" 184 | 185 | # We must return an error code here to let zsh know that there were no 186 | # completions found by _describe; this is what will trigger other 187 | # matching algorithms to attempt to find completions. 188 | # For example zsh can match letters in the middle of words. 189 | return 1 190 | else 191 | # Perform file completion 192 | __trpc-cli_debug "Activating file completion" 193 | 194 | # We must return the result of this command, so it must be the 195 | # last command, or else we must store its result to return it. 196 | _arguments '*:filename:_files'" ${flagPrefix}" 197 | fi 198 | fi 199 | fi 200 | } 201 | 202 | # don't run the completion function when being source-ed or eval-ed 203 | if [ "$funcstack[1]" = "_trpc-cli" ]; then 204 | _trpc-cli 205 | fi 206 | -------------------------------------------------------------------------------- /src/custom/_youtube-dl: -------------------------------------------------------------------------------- 1 | #compdef youtube-dl 2 | 3 | # zsh completions for 'youtube-dl' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-h,--help}'[print this help text and exit]' 9 | '--version[print program version and exit]' 10 | {-U,--update}'[update this program to latest version.]' 11 | {-i,--ignore-errors}'[continue on download errors, for]' 12 | '--abort-on-error[abort downloading of further videos (in]' 13 | '--dump-user-agent[display the current browser]' 14 | '--list-extractors[list all supported extractors]' 15 | '--extractor-descriptions[output descriptions of all supported]' 16 | '--force-generic-extractor[force extraction to use the generic]' 17 | '--default-search[use this prefix for unqualified URLs.]' 18 | '--ignore-config[do not read configuration files. When]' 19 | '--config-location[location of the configuration file;]' 20 | '--flat-playlist[do not extract the videos of a]' 21 | '--mark-watched[mark videos watched (YouTube only)]' 22 | '--no-mark-watched[do not mark videos watched (YouTube]' 23 | '--no-color[do not emit color codes in output]' 24 | '--proxy[use the specified HTTP/HTTPS/SOCKS]' 25 | '--socket-timeout[time to wait before giving up, in]' 26 | '--source-address[client-side IP address to bind to]' 27 | {-4,--force-ipv4}'[make all connections via IPv4]' 28 | {-6,--force-ipv6}'[make all connections via IPv6]' 29 | '--geo-verification-proxy[use this proxy to verify the IP address]' 30 | '--geo-bypass[bypass geographic restriction via]' 31 | '--no-geo-bypass[do not bypass geographic restriction]' 32 | '--geo-bypass-country[force bypass geographic restriction]' 33 | '--geo-bypass-ip-block[force bypass geographic restriction]' 34 | '--playlist-start[playlist video to start at (default is]' 35 | '--playlist-end[playlist video to end at (default is]' 36 | '--playlist-items[playlist video items to download.]' 37 | '--playlist-items[3,7,10-13", it will]' 38 | '--match-title[download only matching titles (regex or]' 39 | '--reject-title[skip download for matching titles]' 40 | '--max-downloads[abort after downloading NUMBER files]' 41 | '--min-filesize[do not download any videos smaller than]' 42 | '--max-filesize[do not download any videos larger than]' 43 | '--date[download only videos uploaded in this]' 44 | '--datebefore[download only videos uploaded on or]' 45 | '--dateafter[download only videos uploaded on or]' 46 | '--min-views[do not download any videos with less]' 47 | '--max-views[do not download any videos with more]' 48 | '--match-filter[generic video filter. Specify any key]' 49 | '--match-filter[> 100 &]' 50 | '--no-playlist[download only the video, if the URL]' 51 | '--yes-playlist[download the playlist, if the URL]' 52 | '--age-limit[download only videos suitable for the]' 53 | '--download-archive[download only videos not listed in the]' 54 | '--include-ads[download advertisements as well]' 55 | {-r,--limit-rate}'[maximum download rate in bytes per]' 56 | {-R,--retries}'[number of retries (default is 10), or]' 57 | '--fragment-retries[number of retries for a fragment]' 58 | '--skip-unavailable-fragments[skip unavailable fragments (DASH]' 59 | '--abort-on-unavailable-fragment[abort downloading when some fragment is]' 60 | '--keep-fragments[keep downloaded fragments on disk after]' 61 | '--buffer-size[size of download buffer (e.g. 1024 or]' 62 | '--no-resize-buffer[do not automatically adjust the buffer]' 63 | '--http-chunk-size[size of a chunk for chunk-based HTTP]' 64 | '--playlist-reverse[download playlist videos in reverse]' 65 | '--playlist-random[download playlist videos in random]' 66 | '--xattr-set-filesize[set file xattribute ytdl.filesize with]' 67 | '--hls-prefer-native[use the native HLS downloader instead]' 68 | '--hls-prefer-ffmpeg[use ffmpeg instead of the native HLS]' 69 | '--hls-use-mpegts[use the mpegts container for HLS]' 70 | '--external-downloader[use the specified external downloader.]' 71 | '--external-downloader-args[give these arguments to the external]' 72 | {-a,--batch-file}'[file containing URLs to download (-]' 73 | '--id[use only video ID in file name]' 74 | {-o,--output}'[output filename template, see the]' 75 | '--output-na-placeholder[placeholder value for unavailable meta]' 76 | '--autonumber-start[specify the start value for]' 77 | '--restrict-filenames[restrict filenames to only ASCII]' 78 | {-w,--no-overwrites}'[do not overwrite files]' 79 | {-c,--continue}'[force resume of partially downloaded]' 80 | '--no-continue[do not resume partially downloaded]' 81 | '--no-part[do not use .part files - write directly]' 82 | '--no-mtime[do not use the Last-modified header to]' 83 | '--write-description[write video description to a]' 84 | '--write-info-json[write video metadata to a .info.json]' 85 | '--write-annotations[write video annotations to a]' 86 | '--load-info-json[JSON file containing the video]' 87 | '--cookies[file to read cookies from and dump]' 88 | '--cache-dir[location in the filesystem where]' 89 | '--no-cache-dir[disable filesystem caching]' 90 | '--rm-cache-dir[delete all filesystem cache files]' 91 | '--write-thumbnail[write thumbnail image to disk]' 92 | '--write-all-thumbnails[write all thumbnail image formats to]' 93 | '--list-thumbnails[simulate and list all available]' 94 | {-q,--quiet}'[activate quiet mode]' 95 | '--no-warnings[ignore warnings]' 96 | {-s,--simulate}'[do not download the video and do not]' 97 | '--skip-download[do not download the video]' 98 | {-g,--get-url}'[simulate, quiet but print URL]' 99 | {-e,--get-title}'[simulate, quiet but print title]' 100 | '--get-id[simulate, quiet but print id]' 101 | '--get-thumbnail[simulate, quiet but print thumbnail URL]' 102 | '--get-description[simulate, quiet but print video]' 103 | '--get-duration[simulate, quiet but print video length]' 104 | '--get-filename[simulate, quiet but print output]' 105 | '--get-format[simulate, quiet but print output format]' 106 | {-j,--dump-json}'[simulate, quiet but print JSON]' 107 | {-J,--dump-single-json}'[simulate, quiet but print JSON]' 108 | '--print-json[be quiet and print the video]' 109 | '--newline[output progress bar as new lines]' 110 | '--no-progress[do not print progress bar]' 111 | '--console-title[display progress in console titlebar]' 112 | {-v,--verbose}'[print various debugging information]' 113 | '--dump-pages[print downloaded pages encoded using]' 114 | '--write-pages[write downloaded intermediary pages to]' 115 | '--print-traffic[display sent and read HTTP traffic]' 116 | {-C,--call-home}'[contact the youtube-dl server for]' 117 | '--no-call-home[do NOT contact the youtube-dl server]' 118 | '--encoding[force the specified encoding]' 119 | '--no-check-certificate[suppress HTTPS certificate validation]' 120 | '--prefer-insecure[use an unencrypted connection to]' 121 | '--user-agent[specify a custom user agent]' 122 | '--referer[specify a custom referer, use if the]' 123 | '--add-header[specify a custom HTTP header and its]' 124 | '--bidi-workaround[work around terminals that lack]' 125 | '--sleep-interval[number of seconds to sleep before each]' 126 | '--max-sleep-interval[upper bound of a range for randomized]' 127 | {-f,--format}'[video format code, see the "FORMAT]' 128 | '--all-formats[download all available video formats]' 129 | '--prefer-free-formats[prefer free video formats unless a]' 130 | {-F,--list-formats}'[list all available formats of requested]' 131 | '--youtube-skip-dash-manifest[do not download the DASH manifests and]' 132 | '--merge-output-format[if a merge is required (e.g.]' 133 | '--write-sub[write subtitle file]' 134 | '--write-auto-sub[write automatically generated subtitle]' 135 | '--all-subs[download all the available subtitles of]' 136 | '--list-subs[list all available subtitles for the]' 137 | '--sub-format[subtitle format, accepts formats]' 138 | '--sub-lang[languages of the subtitles to download]' 139 | '--list-subs[available language tags]' 140 | {-u,--username}'[login with this account ID]' 141 | {-p,--password}'[account password. If this option is]' 142 | {-2,--twofactor}'[two-factor authentication code]' 143 | {-n,--netrc}'[use .netrc authentication data]' 144 | '--video-password[video password (vimeo, youku)]' 145 | '--ap-mso[adobe Pass multiple-system operator (TV]' 146 | '--ap-username[multiple-system operator account login]' 147 | '--ap-password[multiple-system operator account]' 148 | '--ap-list-mso[list all supported multiple-system]' 149 | {-x,--extract-audio}'[convert video files to audio-only files]' 150 | '--audio-format[specify audio format: "best", "aac"]' 151 | '--audio-quality[specify ffmpeg/avconv audio quality]' 152 | '--recode-video[encode the video to another format if]' 153 | '--postprocessor-args[give these arguments to the]' 154 | {-k,--keep-video}'[keep the video file on disk after the]' 155 | '--no-post-overwrites[do not overwrite post-processed files;]' 156 | '--embed-subs[embed subtitles in the video (only for]' 157 | '--embed-thumbnail[embed thumbnail in the audio as cover]' 158 | '--add-metadata[write metadata to the video file]' 159 | '--metadata-from-title[parse additional metadata like song]' 160 | '--output[. Regular expression with named]' 161 | '--xattrs[write metadata to the video files]' 162 | '--fixup[automatically correct known faults of]' 163 | '--prefer-avconv[prefer avconv over ffmpeg for running]' 164 | '--prefer-ffmpeg[prefer ffmpeg over avconv for running]' 165 | '--ffmpeg-location[location of the ffmpeg/avconv binary;]' 166 | '--exec[execute a command on the file after]' 167 | '--convert-subs[convert the subtitles to other format]' 168 | '*:filename:_files' 169 | ) 170 | 171 | _arguments -s $arguments 172 | -------------------------------------------------------------------------------- /src/custom/_yt-dlp: -------------------------------------------------------------------------------- 1 | #compdef yt-dlp 2 | 3 | # zsh completions for 'yt-dlp' 4 | # automatically generated with http://github.com/RobSis/zsh-completion-generator 5 | local arguments 6 | 7 | arguments=( 8 | {-h,--help}'[print this help text and exit]' 9 | '--version[print program version and exit]' 10 | {-U,--update}'[check if updates are available. You]' 11 | '--no-update[do not check for updates (default)]' 12 | '--update-to[@\[TAG\] Upgrade/downgrade to a specific version.]' 13 | {-i,--ignore-errors}'[ignore download and postprocessing errors.]' 14 | '--no-abort-on-error[continue with next video on download errors;]' 15 | '--abort-on-error[abort downloading of further videos if an]' 16 | '--dump-user-agent[display the current user-agent and exit]' 17 | '--list-extractors[list all supported extractors and exit]' 18 | '--extractor-descriptions[output descriptions of all supported]' 19 | '--use-extractors[extractor names to use separated by commas.]' 20 | '--default-search[use this prefix for unqualified URLs. E.g.]' 21 | '--ignore-config[dont load any more configuration files]' 22 | '--no-config-locations[do not load any custom configuration files]' 23 | '--config-locations[location of the main configuration file;]' 24 | '--plugin-dirs[path to an additional directory to search]' 25 | '--no-plugin-dirs[clear plugin directories to search]' 26 | '--flat-playlist[do not extract a playlists URL result]' 27 | '--no-flat-playlist[fully extract the videos of a playlist]' 28 | '--live-from-start[download livestreams from the start.]' 29 | '--no-live-from-start[download livestreams from the current time]' 30 | '--wait-for-video[wait for scheduled streams to become]' 31 | '--no-wait-for-video[do not wait for scheduled streams (default)]' 32 | '--mark-watched[mark videos watched (even with --simulate)]' 33 | '--no-mark-watched[do not mark videos watched (default)]' 34 | '--color[whether to emit color codes in output]' 35 | '--compat-options[options that can help keep compatibility]' 36 | '--alias[OPTIONS Create aliases for an option string. Unless]' 37 | '--proxy[use the specified HTTP/HTTPS/SOCKS proxy. To]' 38 | '--socket-timeout[time to wait before giving up, in seconds]' 39 | '--source-address[client-side IP address to bind to]' 40 | '--impersonate[client to impersonate for requests. E.g.]' 41 | '--impersonate[" to impersonate any client.]' 42 | '--list-impersonate-targets[list available clients to impersonate.]' 43 | {-4,--force-ipv4}'[make all connections via IPv4]' 44 | {-6,--force-ipv6}'[make all connections via IPv6]' 45 | '--enable-file-urls[enable file:// URLs. This is disabled by]' 46 | '--geo-verification-proxy[use this proxy to verify the IP address for]' 47 | '--xff[how to fake X-Forwarded-For HTTP header to]' 48 | {-I,--playlist-items}'[comma separated playlist_index of the items]' 49 | '--min-filesize[abort download if filesize is smaller than]' 50 | '--max-filesize[abort download if filesize is larger than]' 51 | '--date[download only videos uploaded on this date.]' 52 | '--datebefore[download only videos uploaded on or before]' 53 | '--dateafter[download only videos uploaded on or after]' 54 | '--match-filters[generic video filter. Any "OUTPUT TEMPLATE"]' 55 | '--no-match-filters[do not use any --match-filters (default)]' 56 | '--break-match-filters[same as "--match-filters" but stops the]' 57 | '--no-break-match-filters[do not use any --break-match-filters]' 58 | '--no-playlist[download only the video, if the URL refers]' 59 | '--yes-playlist[download the playlist, if the URL refers to]' 60 | '--age-limit[download only videos suitable for the given]' 61 | '--download-archive[download only videos not listed in the]' 62 | '--no-download-archive[do not use archive file (default)]' 63 | '--max-downloads[abort after downloading NUMBER files]' 64 | '--break-on-existing[stop the download process when encountering]' 65 | '--no-break-on-existing[do not stop the download process when]' 66 | '--break-per-input[alters --max-downloads, --break-on-existing]' 67 | '--break-match-filters[and autonumber to]' 68 | {--no-break-per-input,--break-on-existing}'[similar options]' 69 | '--skip-playlist-after-errors[number of allowed failures until the rest of]' 70 | {-N,--concurrent-fragments}'[number of fragments of a dash/hlsnative]' 71 | {-r,--limit-rate}'[maximum download rate in bytes per second]' 72 | '--throttled-rate[minimum download rate in bytes per second]' 73 | {-R,--retries}'[number of retries (default is 10), or]' 74 | '--file-access-retries[number of times to retry on file access]' 75 | '--fragment-retries[number of retries for a fragment (default is]' 76 | '--retry-sleep[time to sleep between retries in seconds]' 77 | '--skip-unavailable-fragments[skip unavailable fragments for DASH]' 78 | '--abort-on-unavailable-fragments[abort download if a fragment is unavailable]' 79 | '--keep-fragments[keep downloaded fragments on disk after]' 80 | '--no-keep-fragments[delete downloaded fragments after]' 81 | '--buffer-size[size of download buffer, e.g. 1024 or 16K]' 82 | '--resize-buffer[the buffer size is automatically resized]' 83 | '--no-resize-buffer[do not automatically adjust the buffer size]' 84 | '--http-chunk-size[size of a chunk for chunk-based HTTP]' 85 | '--playlist-random[download playlist videos in random order]' 86 | '--lazy-playlist[process entries in the playlist as they are]' 87 | {--playlist-random,--playlist-reverse}'[]' 88 | '--no-lazy-playlist[process videos in the playlist only after]' 89 | '--xattr-set-filesize[set file xattribute ytdl.filesize with]' 90 | '--hls-use-mpegts[use the mpegts container for HLS videos;]' 91 | '--no-hls-use-mpegts[do not use the mpegts container for HLS]' 92 | '--download-sections[download only chapters that match the]' 93 | '--downloader[name or path of the external downloader to]' 94 | '--downloader[m3u8:native" will use]' 95 | '--downloader-args[give these arguments to the external]' 96 | '--postprocessor-args[. You can use this]' 97 | '--external-downloader-args[)]' 98 | {-a,--batch-file}'[file containing URLs to download ("-" for]' 99 | '--no-batch-file[do not read URLs from batch file (default)]' 100 | {-P,--paths}'[the paths where the files should be]' 101 | {-o,--output}'[output filename template; see "OUTPUT]' 102 | '--output-na-placeholder[placeholder for unavailable fields in]' 103 | '--output["NA")]' 104 | '--restrict-filenames[restrict filenames to only ASCII characters]' 105 | '--no-restrict-filenames[allow Unicode characters, "&" and spaces in]' 106 | '--windows-filenames[force filenames to be Windows-compatible]' 107 | '--no-windows-filenames[sanitize filenames only minimally]' 108 | '--trim-filenames[limit the filename length (excluding]' 109 | {-w,--no-overwrites}'[do not overwrite any files]' 110 | '--force-overwrites[overwrite all video and metadata files. This]' 111 | '--no-force-overwrites[do not overwrite the video, but overwrite]' 112 | {-c,--continue}'[resume partially downloaded files/fragments]' 113 | '--no-continue[do not resume partially downloaded]' 114 | '--part[use .part files instead of writing directly]' 115 | '--no-part[do not use .part files - write directly into]' 116 | '--mtime[use the Last-modified header to set the file]' 117 | '--no-mtime[do not use the Last-modified header to set]' 118 | '--write-description[write video description to a .description]' 119 | '--no-write-description[do not write video description (default)]' 120 | '--write-info-json[write video metadata to a .info.json file]' 121 | '--no-write-info-json[do not write video metadata (default)]' 122 | '--write-playlist-metafiles[write playlist metadata in addition to the]' 123 | '--write-description[. (default)]' 124 | '--no-write-playlist-metafiles[do not write playlist metadata when using]' 125 | {--write-info-json,--write-description}'[.]' 126 | '--clean-info-json[remove some internal metadata such as]' 127 | '--no-clean-info-json[write all fields to the infojson]' 128 | '--write-comments[retrieve video comments to be placed in the]' 129 | '--no-write-comments[do not retrieve video comments unless the]' 130 | '--no-get-comments[)]' 131 | '--load-info-json[JSON file containing the video information]' 132 | '--cookies[netscape formatted file to read cookies from]' 133 | '--no-cookies[do not read/dump cookies from/to file]' 134 | '--cookies-from-browser[+KEYRING\]\[:PROFILE\]\[::CONTAINER\]]' 135 | '--no-cookies-from-browser[do not load cookies from browser (default)]' 136 | '--cache-dir[location in the filesystem where yt-dlp can]' 137 | '--no-cache-dir[disable filesystem caching]' 138 | '--rm-cache-dir[delete all filesystem cache files]' 139 | '--write-thumbnail[write thumbnail image to disk]' 140 | '--no-write-thumbnail[do not write thumbnail image to disk]' 141 | '--write-all-thumbnails[write all thumbnail image formats to disk]' 142 | '--list-thumbnails[list available thumbnails of each video.]' 143 | '--write-link[write an internet shortcut file, depending]' 144 | '--write-url-link[write a .url Windows internet shortcut. The]' 145 | '--write-webloc-link[write a .webloc macOS internet shortcut]' 146 | '--write-desktop-link[write a .desktop Linux internet shortcut]' 147 | {-q,--quiet}'[activate quiet mode. If used with --verbose]' 148 | '--no-quiet[deactivate quiet mode. (Default)]' 149 | '--no-warnings[ignore warnings]' 150 | {-s,--simulate}'[do not download the video and do not write]' 151 | '--no-simulate[download the video even if printing/listing]' 152 | '--ignore-no-formats-error[ignore "No video formats" error. Useful for]' 153 | '--no-ignore-no-formats-error[throw error when no downloadable video]' 154 | '--skip-download[do not download the video but write all]' 155 | {-O,--print}'[field name or output template to print to]' 156 | '--use-postprocessor[video).]' 157 | '--no-simulate[later stages of WHEN are]' 158 | '--print-to-file[FILE]' 159 | {-j,--dump-json}'[quiet, but print JSON information for each]' 160 | {-J,--dump-single-json}'[quiet, but print JSON information for each]' 161 | '--no-simulate[used. If the URL refers to]' 162 | '--force-write-archive[force download archive entries to be written]' 163 | '--force-download-archive[)]' 164 | '--newline[output progress bar as new lines]' 165 | '--no-progress[do not print progress bar]' 166 | '--progress[show progress bar, even if in quiet mode]' 167 | '--console-title[display progress in console titlebar]' 168 | '--progress-template[template for progress outputs, optionally]' 169 | {--console-title,--progress-template}'["download-]' 170 | '--progress-delta[time between progress output (default: 0)]' 171 | {-v,--verbose}'[print various debugging information]' 172 | '--dump-pages[print downloaded pages encoded using base64]' 173 | '--write-pages[write downloaded intermediary pages to files]' 174 | '--print-traffic[display sent and read HTTP traffic]' 175 | '--encoding[force the specified encoding (experimental)]' 176 | '--legacy-server-connect[explicitly allow HTTPS connection to servers]' 177 | '--no-check-certificates[suppress HTTPS certificate validation]' 178 | '--prefer-insecure[use an unencrypted connection to retrieve]' 179 | '--add-headers[specify a custom HTTP header and its value]' 180 | '--bidi-workaround[work around terminals that lack]' 181 | '--sleep-requests[number of seconds to sleep between requests]' 182 | '--sleep-interval[number of seconds to sleep before each]' 183 | '--max-sleep-interval[maximum number of seconds to sleep. Can only]' 184 | '--sleep-subtitles[number of seconds to sleep before each]' 185 | {-f,--format}'[video format code, see "FORMAT SELECTION"]' 186 | {-S,--format-sort}'[sort the formats by the fields given, see]' 187 | '--format-sort-force[force user specified sort order to have]' 188 | '--no-format-sort-force[some fields have precedence over the user]' 189 | '--video-multistreams[allow multiple video streams to be merged]' 190 | '--no-video-multistreams[only one video stream is downloaded for each]' 191 | '--audio-multistreams[allow multiple audio streams to be merged]' 192 | '--no-audio-multistreams[only one audio stream is downloaded for each]' 193 | '--prefer-free-formats[prefer video formats with free containers]' 194 | '--no-prefer-free-formats[dont give any special preference to free]' 195 | '--check-formats[make sure formats are selected only from]' 196 | '--check-all-formats[check all formats for whether they are]' 197 | '--no-check-formats[do not check that the formats are actually]' 198 | {-F,--list-formats}'[list available formats of each video.]' 199 | '--merge-output-format[containers that may be used when merging]' 200 | '--write-subs[write subtitle file]' 201 | '--no-write-subs[do not write subtitle file (default)]' 202 | '--write-auto-subs[write automatically generated subtitle file]' 203 | '--no-write-auto-subs[do not write auto-generated subtitles]' 204 | '--list-subs[list available subtitles of each video.]' 205 | '--sub-format[subtitle format; accepts formats preference]' 206 | '--sub-langs[languages of the subtitles to download (can]' 207 | '--sub-langs[.*,ja" (where "en.*" is a]' 208 | {-u,--username}'[login with this account ID]' 209 | {-p,--password}'[account password. If this option is left]' 210 | {-2,--twofactor}'[two-factor authentication code]' 211 | {-n,--netrc}'[use .netrc authentication data]' 212 | '--netrc-location[location of .netrc authentication data;]' 213 | '--netrc-cmd[command to execute to get the credentials]' 214 | '--video-password[video-specific password]' 215 | '--ap-mso[adobe Pass multiple-system operator (TV]' 216 | '--ap-username[multiple-system operator account login]' 217 | '--ap-password[multiple-system operator account password.]' 218 | '--ap-list-mso[list all supported multiple-system operators]' 219 | '--client-certificate[path to client certificate file in PEM]' 220 | '--client-certificate-key[path to private key file for client]' 221 | '--client-certificate-password[password for client certificate private key]' 222 | {-x,--extract-audio}'[convert video files to audio-only files]' 223 | '--audio-format[format to convert the audio to when -x is]' 224 | '--audio-quality[specify ffmpeg audio quality to use when]' 225 | '--remux-video[remux the video into another container if]' 226 | '--recode-video[re-encode the video into another format if]' 227 | '--postprocessor-args[give these arguments to the postprocessors.]' 228 | {-k,--keep-video}'[keep the intermediate video file on disk]' 229 | '--no-keep-video[delete the intermediate video file after]' 230 | '--post-overwrites[overwrite post-processed files (default)]' 231 | '--no-post-overwrites[do not overwrite post-processed files]' 232 | '--embed-subs[embed subtitles in the video (only for mp4]' 233 | '--no-embed-subs[do not embed subtitles (default)]' 234 | '--embed-thumbnail[embed thumbnail in the video as cover art]' 235 | '--no-embed-thumbnail[do not embed thumbnail (default)]' 236 | '--embed-metadata[embed metadata to the video file. Also]' 237 | '--no-embed-chapters[/--no-embed-info-json are]' 238 | '--no-embed-metadata[do not add metadata to file (default)]' 239 | '--embed-chapters[add chapter markers to the video file]' 240 | '--no-embed-chapters[do not add chapter markers (default) (Alias:]' 241 | '--no-add-chapters[)]' 242 | '--embed-info-json[embed the infojson as an attachment to]' 243 | '--no-embed-info-json[do not embed the infojson as an attachment]' 244 | '--parse-metadata[parse additional metadata like title/artist]' 245 | '--replace-in-metadata[REGEX REPLACE]' 246 | '--xattrs[write metadata to the video files xattrs]' 247 | '--concat-playlist[concatenate videos in a playlist. One of]' 248 | '--fixup[automatically correct known faults of the]' 249 | '--ffmpeg-location[location of the ffmpeg binary; either the]' 250 | '--exec[execute a command, optionally prefixed with]' 251 | '--no-exec[remove any previously defined --exec]' 252 | '--convert-subs[convert the subtitles to another format]' 253 | '--convert-thumbnails[convert the thumbnails to another format]' 254 | '--split-chapters[split video into multiple files based on]' 255 | '--no-split-chapters[do not split video based on chapters]' 256 | '--remove-chapters[remove chapters whose title matches the]' 257 | '--no-remove-chapters[do not remove any chapters from the file]' 258 | '--force-keyframes-at-cuts[force keyframes at cuts when]' 259 | '--no-force-keyframes-at-cuts[do not force keyframes around the chapters]' 260 | '--use-postprocessor[the (case-sensitive) name of plugin]' 261 | '--print[/--output), "before_dl" (before each]' 262 | '--sponsorblock-mark[sponsorBlock categories to create chapters]' 263 | {--sponsorblock-mark,-preview}'[1\] https:/]' 264 | '--sponsorblock-remove[sponsorBlock categories to be removed from]' 265 | '--sponsorblock-mark[that "default"]' 266 | '--sponsorblock-chapter-title[an output template for the title of the]' 267 | '--sponsorblock-mark[. The only available]' 268 | '--no-sponsorblock[disable both --sponsorblock-mark and]' 269 | '--sponsorblock-remove[]' 270 | '--sponsorblock-api[sponsorBlock API location, defaults to]' 271 | '--extractor-retries[number of retries for known extractor errors]' 272 | '--allow-dynamic-mpd[process dynamic DASH manifests (default)]' 273 | '--ignore-dynamic-mpd[do not process dynamic DASH manifests]' 274 | '--hls-split-discontinuity[split HLS playlists to different formats at]' 275 | '--no-hls-split-discontinuity[do not split HLS playlists into different]' 276 | '--extractor-args[pass ARGS arguments to the IE_KEY extractor.]' 277 | '*:filename:_files' 278 | ) 279 | 280 | _arguments -s $arguments 281 | -------------------------------------------------------------------------------- /src/custom/npm.plugin.zsh: -------------------------------------------------------------------------------- 1 | ###-begin-npm-completion-### 2 | # 3 | # npm command completion script 4 | # 5 | # Installation: npm completion >> ~/.bashrc (or ~/.zshrc) 6 | # Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm 7 | # 8 | 9 | if type complete &>/dev/null; then 10 | _npm_completion () { 11 | local words cword 12 | if type _get_comp_words_by_ref &>/dev/null; then 13 | _get_comp_words_by_ref -n = -n @ -n : -w words -i cword 14 | else 15 | cword="$COMP_CWORD" 16 | words=("${COMP_WORDS[@]}") 17 | fi 18 | 19 | local si="$IFS" 20 | if ! IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ 21 | COMP_LINE="$COMP_LINE" \ 22 | COMP_POINT="$COMP_POINT" \ 23 | npm completion -- "${words[@]}" \ 24 | 2>/dev/null)); then 25 | local ret=$? 26 | IFS="$si" 27 | return $ret 28 | fi 29 | IFS="$si" 30 | if type __ltrim_colon_completions &>/dev/null; then 31 | __ltrim_colon_completions "${words[cword]}" 32 | fi 33 | } 34 | complete -o default -F _npm_completion npm 35 | elif type compdef &>/dev/null; then 36 | _npm_completion() { 37 | local si=$IFS 38 | compadd -- $(COMP_CWORD=$((CURRENT-1)) \ 39 | COMP_LINE=$BUFFER \ 40 | COMP_POINT=0 \ 41 | npm completion -- "${words[@]}" \ 42 | 2>/dev/null) 43 | IFS=$si 44 | } 45 | compdef _npm_completion npm 46 | elif type compctl &>/dev/null; then 47 | _npm_completion () { 48 | local cword line point words si 49 | read -Ac words 50 | read -cn cword 51 | let cword-=1 52 | read -l line 53 | read -ln point 54 | si="$IFS" 55 | if ! IFS=$'\n' reply=($(COMP_CWORD="$cword" \ 56 | COMP_LINE="$line" \ 57 | COMP_POINT="$point" \ 58 | npm completion -- "${words[@]}" \ 59 | 2>/dev/null)); then 60 | 61 | local ret=$? 62 | IFS="$si" 63 | return $ret 64 | fi 65 | IFS="$si" 66 | } 67 | compctl -K _npm_completion npm 68 | fi 69 | ###-end-npm-completion-### 70 | -------------------------------------------------------------------------------- /src/custom/pip.plugin.zsh: -------------------------------------------------------------------------------- 1 | function _pip_completion { 2 | local words cword 3 | read -Ac words 4 | read -cn cword 5 | reply=( $( COMP_WORDS="$words[*]" \ 6 | COMP_CWORD=$(( cword-1 )) \ 7 | PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) 8 | } 9 | compctl -K _pip_completion pip 10 | -------------------------------------------------------------------------------- /src/custom/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | _custom_dir="$(git rev-parse --show-toplevel)/src/custom" 4 | 5 | _genhelp() { 6 | "${1}" --help | "${_custom_dir}/genhelp/help2comp.py" "${1}" > "${_custom_dir}/_${1}" 7 | } 8 | 9 | cd "${_custom_dir}" 10 | [ -x "$(command -v limactl)" ] && limactl completion zsh > _limactl 11 | [ -x "$(command -v mdbook)" ] && mdbook completions zsh > _mdbook 12 | [ -x "$(command -v hugo)" ] && hugo completion zsh > _hugo 13 | [ -x "$(command -v rg)" ] && rg --generate complete-zsh > _rg 14 | [ -x "$(command -v npm)" ] && npm completion > npm.plugin.zsh 15 | [ -x "$(command -v pnpm)" ] && pnpm completion zsh > _pnpm 16 | [ -x "$(command -v deno)" ] && deno completions zsh > _deno 17 | [ -x "$(command -v rustup)" ] && rustup completions zsh rustup > _rustup 18 | [ -x "$(command -v rustup)" ] && rustup completions zsh cargo > _cargo 19 | [ -x "$(command -v kubectl)" ] && kubectl completion zsh > _kubectl 20 | [ -x "$(command -v helm)" ] && helm completion zsh > _helm 21 | [ -x "$(command -v tinymist)" ] && tinymist completion > _tinymist 22 | [ -x "$(command -v trpc-cli)" ] && trpc-cli completion zsh > _trpc-cli 23 | [ -x "$(command -v asdf)" ] && asdf completion zsh > _asdf 24 | [ -x "$(command -v cargo-fmt)" ] && _genhelp cargo-fmt 25 | [ -x "$(command -v cargo-clippy)" ] && _genhelp cargo-clippy 26 | [ -x "$(command -v rust-analyzer)" ] && _genhelp rust-analyzer 27 | [ -x "$(command -v rust-gdb)" ] && [ -x "$(command -v gdb)" ] && _genhelp rust-gdb 28 | [ -x "$(command -v rust-lldb)" ] && [ -x "$(command -v lldb)" ] && _genhelp rust-lldb 29 | [ -x "$(command -v rustc)" ] && _genhelp rustc 30 | [ -x "$(command -v rustdoc)" ] && _genhelp rustdoc 31 | [ -x "$(command -v rustfmt)" ] && _genhelp rustfmt 32 | [ -x "$(command -v rustc)" ] && _genhelp rustc 33 | [ -x "$(command -v fzf)" ] && _genhelp fzf 34 | [ -x "$(command -v youtube-dl)" ] && _genhelp youtube-dl 35 | [ -x "$(command -v yt-dlp)" ] && _genhelp yt-dlp 36 | [ -x "$(command -v rip)" ] && _genhelp rip 37 | [ -x "$(command -v axel)" ] && _genhelp axel 38 | curl -LO https://github.com/docker/cli/raw/master/contrib/completion/zsh/_docker 39 | curl -LO https://github.com/containers/podman/raw/main/completions/zsh/_podman 40 | curl -LO https://github.com/containers/podman/raw/main/completions/zsh/_podman-remote 41 | curl -LO https://github.com/sharkdp/fd/raw/master/contrib/completion/_fd 42 | curl -LO https://github.com/rofl0r/proxychains-ng/raw/master/completions/zsh/_proxychains4 43 | curl -L -o _tldr https://github.com/dbrgn/tealdeer/raw/main/completion/zsh_tealdeer 44 | curl -L -o _bun https://github.com/oven-sh/bun/raw/main/completions/bun.zsh 45 | -------------------------------------------------------------------------------- /zsh-completions.plugin.zsh: -------------------------------------------------------------------------------- 1 | source "${0:h}/src/zsh-users.zsh-completions/zsh-completions.plugin.zsh" 2 | source "${0:h}/src/zchee.zsh-completions/zsh-completions.plugin.zsh" 3 | [ -x "$(command -v nix-env)" ] && source "${0:h}/src/spwhitt.nix-zsh-completions/nix-zsh-completions.plugin.zsh" 4 | [ -x "$(command -v gradle)" ] && source "${0:h}/src/gradle.gradle-completion/gradle-completion.plugin.zsh" 5 | [ -x "$(command -v conda)" ] && source "${0:h}/src/conda-incubator.conda-zsh-completion/conda-zsh-completion.plugin.zsh" 6 | [ -x "$(command -v npm)" ] && source "${0:h}/src/custom/npm.plugin.zsh" 7 | [ -x "$(command -v pip)" ] && source "${0:h}/src/custom/pip.plugin.zsh" 8 | fpath+="${0:h}/src/custom" 9 | 10 | --------------------------------------------------------------------------------