Expand description
Tab completion for the interpreter prompt.
This module provides autocompletion functionality for the Tor interpreter, enabling tab completion of commands, options, and arguments.
§Overview
The Autocompleter queries Tor for available commands and options,
building a comprehensive list of completions including:
- Interpreter commands (
/help,/events,/info, etc.) - Tor control commands (
GETINFO,GETCONF,SETCONF, etc.) - Command arguments (config options, event types, signals)
- Help topics
§Architecture
On initialization, the autocompleter queries Tor for:
info/names- Available GETINFO optionsconfig/names- Configuration options for GETCONF/SETCONF/RESETCONFevents/names- Event types for SETEVENTSfeatures/names- Features for USEFEATUREsignal/names- Signals for SIGNAL command
These are combined with built-in commands to create the completion list.
§Example
use stem_rs::Controller;
use stem_rs::interpreter::autocomplete::Autocompleter;
let mut controller = Controller::from_port("127.0.0.1:9051".parse()?).await?;
controller.authenticate(None).await?;
let autocompleter = Autocompleter::new(&mut controller).await;
// Get all matches for partial input
let matches = autocompleter.matches("GETINFO");
for m in matches {
println!("{}", m);
}
// Get specific completion by index (for readline integration)
if let Some(completion) = autocompleter.complete("GETINFO", 0) {
println!("First match: {}", completion);
}§Python Stem Equivalent
This module corresponds to Python Stem’s stem.interpreter.autocomplete module.
Structs§
- Autocompleter
- Tab completion provider for the interpreter.