From fb2ffa849a2cf9251cc274ebea5daa9898579787 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 26 Mar 2026 15:55:10 +0800 Subject: Add shell completion system with descriptions and i18n support --- src/cmds/comp/sheetedit.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/cmds/comp/sheetedit.rs') diff --git a/src/cmds/comp/sheetedit.rs b/src/cmds/comp/sheetedit.rs index d210028..1ebf63d 100644 --- a/src/cmds/comp/sheetedit.rs +++ b/src/cmds/comp/sheetedit.rs @@ -1,15 +1,20 @@ -use cli_utils::string_vec; +use comp_system_macros::{file_suggest, suggest}; +use rust_i18n::t; -use crate::systems::comp::context::CompletionContext; +use crate::systems::comp::{context::CompletionContext, result::CompletionResult}; -pub fn comp(ctx: CompletionContext) -> Option> { +pub fn comp(ctx: CompletionContext) -> CompletionResult { if ctx.current_word.starts_with('-') { - return Some(string_vec!["-e", "--editor"]); + return suggest!( + "-e" = t!("sheetedit.comp.editor").trim(), + "--editor" = t!("sheetedit.comp.editor").trim(), + ) + .into(); } if ctx.previous_word == "-e" || ctx.previous_word == "--editor" { - return Some(vec![]); + return suggest!().into(); } - None + file_suggest!() } -- cgit