pub struct GenerateCompletionArgs {
pub shell: Shell,
}
Expand description
Command-line arguments for generating shell completion scripts.
The generate-completion command creates shell-specific completion scripts that enable intelligent tab completion for SubX commands and arguments. This greatly enhances the command-line user experience by providing context-aware suggestions and reducing typing requirements.
§Completion Capabilities
Generated scripts provide completion for:
- Subcommands:
match
,convert
,sync
,detect-encoding
, etc. - Flags and Options:
--format
,--output
,--confidence
, etc. - Enum Values: Available formats, AI providers, sync methods
- File Paths: Intelligent file and directory completion
- Configuration Keys: Valid configuration setting names
§Shell Integration
Each shell has different integration methods:
- Immediate: Load completion in current session
- Persistent: Add to shell configuration for permanent availability
- System-wide: Install for all users on the system
- Per-project: Enable completion in specific project directories
§Performance Considerations
Completion scripts are optimized for performance:
- Lazy Loading: Completions are generated on-demand
- Caching: Results are cached where appropriate
- Minimal Overhead: Scripts add minimal startup time to shell
- Incremental Updates: Only regenerate when command structure changes
§Examples
use subx_cli::cli::GenerateCompletionArgs;
use clap_complete::Shell;
// Generate Bash completion
let bash_args = GenerateCompletionArgs {
shell: Shell::Bash,
};
// Generate Zsh completion
let zsh_args = GenerateCompletionArgs {
shell: Shell::Zsh,
};
// Generate Fish completion
let fish_args = GenerateCompletionArgs {
shell: Shell::Fish,
};
Fields§
§shell: Shell
Target shell for completion script generation
Trait Implementations§
Source§impl Args for GenerateCompletionArgs
impl Args for GenerateCompletionArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Append to
Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
Read moreSource§impl Debug for GenerateCompletionArgs
impl Debug for GenerateCompletionArgs
Source§impl FromArgMatches for GenerateCompletionArgs
impl FromArgMatches for GenerateCompletionArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches
to self
.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches
to self
.Auto Trait Implementations§
impl Freeze for GenerateCompletionArgs
impl RefUnwindSafe for GenerateCompletionArgs
impl Send for GenerateCompletionArgs
impl Sync for GenerateCompletionArgs
impl Unpin for GenerateCompletionArgs
impl UnwindSafe for GenerateCompletionArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more