Skip to main content

Module command_parser

Module command_parser 

Source
Expand description

Command Mode grammar: parsing, history, completion, and validation.

Handles the : and !-prefixed command grammar including :mkdir, :touch, :rename, :mv, :cp, :git, :set, :term, and !<shell>.

§Grammar

command ::= ":" verb (" " arg)*
          | "!" shell_string

verb    ::= "mkdir" | "touch" | "rename" | "mv" | "cp" | "git" | "set"
          | "sort" | "bookmark" | "jump" | "unmark" | "config" | "plugin"
          | "term"

Parsing only validates shape; what a command does is actions::mod’s business. :git runs git through the configured shell, and :set goes through TrailConfig::set_value.

Structs§

CommandHistory
A ring buffer of past commands, persisted to a small cache file.
CompletionSources
What completion can offer beyond verbs and the filesystem: names that live in Trail’s own state rather than on disk.
TabState
Tracks the current tab-completion cycle.

Enums§

FeedResult
The result of feeding one keystroke to Command Mode.
ParseError
Validation errors produced during command parsing.
ParsedCommand
A successfully parsed, validated Command Mode input.

Functions§

completions
Returns a list of completion candidates for the current command buffer.
completions_with_sources
Same as completions, but with plugin action names and bookmarks to offer as well.
feed
Feeds a single keystroke into Command Mode state.
feed_with_sources
Same as feed, but completion also offers plugin action names and bookmarks.
parse
Parse buffer (the text typed after : or !) into a ParsedCommand.