From 10ed02b8541a80e60f7ad9f9fb51f8070d6be525 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 15 Mar 2026 01:12:06 +0800 Subject: Add completions system for shell autocompletion --- src/systems/comp/context.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/systems/comp/context.rs (limited to 'src/systems/comp/context.rs') diff --git a/src/systems/comp/context.rs b/src/systems/comp/context.rs new file mode 100644 index 0000000..36d1840 --- /dev/null +++ b/src/systems/comp/context.rs @@ -0,0 +1,33 @@ +use clap::{Parser, command}; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +pub struct CompletionContext { + /// The full command line + #[arg(short = 'f', long)] + pub command_line: String, + + /// Cursor position + #[arg(short = 'C', long)] + pub cursor_position: usize, + + /// Current word + #[arg(short = 'w', long)] + pub current_word: String, + + /// Previous word + #[arg(short = 'p', long)] + pub previous_word: String, + + /// Command name + #[arg(short = 'c', long)] + pub command_name: String, + + /// Word index + #[arg(short = 'i', long)] + pub word_index: usize, + + /// All words + #[arg(short = 'a', long, num_args = 1..)] + pub all_words: Vec, +} -- cgit