fix: opts spacing

This commit is contained in:
iff 2025-01-07 01:16:54 +01:00
parent e53c61cb59
commit 87be5ffacb
5 changed files with 26 additions and 7 deletions

View file

@ -30,7 +30,14 @@ pub fn opts(suggest: &mut String, last_command: &mut String, opt_list: &mut Vec<
let regex = opt.trim();
let current_tag = tag(tag_name, replace_tag);
let opts = format!(" {}", opt_regex(regex, last_command));
let opts = {
let caps = opt_regex(regex, last_command);
if caps.is_empty() {
"".to_string()
} else {
format!(" {}", caps)
}
};
opt_list.push((current_tag.clone(), opts));
suggest.replace_range(placeholder, &current_tag);