Expand description
Shell completion support for click-rs.
This module provides shell completion functionality for Bash, Zsh, and Fish shells. It generates completion scripts that can be sourced in each shell to provide tab completion for CLI applications built with click-rs.
§Reference
Based on Python Click’s shell_completion.py.
§Example
use click::completion::{get_completion_class, shell_complete};
use click::command::Command;
let cmd = Command::new("myapp").build();
// Generate completion script for bash
if let Some(completer) = get_completion_class("bash") {
let script = completer.source_template();
println!("{}", script.replace("%(prog_name)s", "myapp"));
}Structs§
- Bash
Complete - Bash shell completion implementation.
- Completion
Args - Arguments parsed from the shell completion environment.
- Completion
Option - Configuration for the shell completion option.
- Fish
Complete - Fish shell completion implementation.
- ZshComplete
- Zsh shell completion implementation.
Traits§
- Shell
Complete - Trait for shell-specific completion implementations.
Functions§
- detect_
shell - Detect the current shell from environment.
- get_
completion_ class - Get a shell completion implementation by name.
- get_
completions - Get completions for a command.
- list_
shells - List all supported shell names.
- make_
completion_ option - Add the shell completion option to a command.
- shell_
complete - Main shell completion entry point.