Skip to main content

Module completion

Module completion 

Source
Expand description

Structured command and pipe completion types. Completion exists to turn a partially typed line plus cursor position into a ranked suggestion set.

This module stays deliberately free of terminal state, network access, and REPL/editor concerns. The core flow is:

  • tree: build a static command/config completion tree
  • parse: tokenize and analyze a partially typed command line
  • suggest: rank and shape suggestions from the parsed cursor context

Outer layers such as crate::cli and crate::repl inject dynamic command catalogs, shell scope, alias expansion, and live prompt behavior on top of this pure engine.

Contract:

  • completion logic may depend on structured command metadata and cursor state
  • it should not depend on terminal painting, network I/O, plugin process execution, or interactive host state

Public API shape:

Re-exports§

pub use engine::CompletionEngine;
pub use model::ArgNode;
pub use model::CommandLine;
pub use model::CompletionAnalysis;
pub use model::CompletionContext;
pub use model::CompletionNode;
pub use model::CompletionRequest;
pub use model::CompletionTree;
pub use model::ContextScope;
pub use model::CursorState;
pub use model::FlagHints;
pub use model::FlagNode;
pub use model::FlagOccurrence;
pub use model::MatchKind;
pub use model::OsVersions;
pub use model::ParsedLine;
pub use model::QuoteStyle;
pub use model::RequestHintSet;
pub use model::RequestHints;
pub use model::Suggestion;
pub use model::SuggestionEntry;
pub use model::SuggestionOutput;
pub use model::TailItem;
pub use model::ValueType;
pub use parse::CommandLineParser;
pub use parse::ParsedCursorLine;
pub use parse::TokenSpan;
pub use suggest::SuggestionEngine;
pub use tree::CommandSpec;
pub use tree::CompletionTreeBuildError;
pub use tree::CompletionTreeBuilder;
pub use tree::ConfigKeySpec;

Modules§

engine
High-level orchestration that combines parsing, context resolution, and suggestion ranking.
model
Shared completion data structures passed between the parser and suggester. Data structures shared across completion parsing, analysis, and ranking.
parse
Tokenization and cursor-aware command-line parsing. Shell-like tokenization and cursor analysis for completion.
suggest
Suggestion ranking and output shaping from parsed cursor state. Suggestion ranking and shaping for completion results.
tree
Declarative completion-tree builders derived from command and config metadata. Declarative builders for the completion engine’s immutable tree model.