|
| 1 | +"""Parser system for command-line input processing. |
| 2 | +
|
| 3 | +This module provides a comprehensive system for parsing user input into |
| 4 | +structured command data, including support for: |
| 5 | +
|
| 6 | +- Text commands with flags and options |
| 7 | +- Shell commands with pass-through execution |
| 8 | +- Command registration and metadata management |
| 9 | +- Parser pipelines for routing input to appropriate parsers |
| 10 | +- Intelligent suggestion generation for typos and completions |
| 11 | +
|
| 12 | +Core Types: |
| 13 | + ParseResult: Structured result of parsing user input |
| 14 | + CommandArgs: Container for positional and named arguments |
| 15 | + Context: Parsing context with history and session state |
| 16 | + ParseError: Exception raised during parsing failures |
| 17 | +
|
| 18 | +Protocols: |
| 19 | + Parser: Protocol for implementing custom parsers |
| 20 | +
|
| 21 | +Parsers: |
| 22 | + TextParser: Handles standard text commands with flags/options |
| 23 | + ShellParser: Handles shell commands prefixed with '!' |
| 24 | +
|
| 25 | +Pipeline: |
| 26 | + ParserPipeline: Routes input to appropriate parsers based on conditions |
| 27 | +
|
| 28 | +Registry: |
| 29 | + CommandRegistry: Manages available commands and provides suggestions |
| 30 | + CommandMetadata: Metadata for registered commands |
| 31 | +""" |
| 32 | + |
| 33 | +from cli_patterns.ui.parser.parsers import ShellParser, TextParser |
| 34 | +from cli_patterns.ui.parser.pipeline import ParserPipeline |
| 35 | +from cli_patterns.ui.parser.protocols import Parser |
| 36 | +from cli_patterns.ui.parser.registry import CommandMetadata, CommandRegistry |
| 37 | +from cli_patterns.ui.parser.types import CommandArgs, Context, ParseError, ParseResult |
| 38 | + |
| 39 | +__all__ = [ |
| 40 | + # Core Types |
| 41 | + "ParseResult", |
| 42 | + "CommandArgs", |
| 43 | + "Context", |
| 44 | + "ParseError", |
| 45 | + # Protocols |
| 46 | + "Parser", |
| 47 | + # Parsers |
| 48 | + "TextParser", |
| 49 | + "ShellParser", |
| 50 | + # Pipeline |
| 51 | + "ParserPipeline", |
| 52 | + # Registry |
| 53 | + "CommandRegistry", |
| 54 | + "CommandMetadata", |
| 55 | +] |
0 commit comments