mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10:09 +01:00
fix: opts spacing
This commit is contained in:
parent
e53c61cb59
commit
87be5ffacb
5 changed files with 26 additions and 7 deletions
|
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Wrong starting distance when including all candidates
|
||||
- Spacings for `opt` placeholder
|
||||
|
||||
## [0.6.9] - 2025-01-06
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -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, ¤t_tag);
|
||||
|
|
|
|||
|
|
@ -42,10 +42,17 @@ pub fn opts(
|
|||
let regex = opt.trim();
|
||||
let current_tag = tag(tag_name, replace_tag);
|
||||
let token_tag: TokenStream2 = format!("{}{}", tag_name, replace_tag).parse().unwrap();
|
||||
let command = quote! {
|
||||
let #token_tag = format!(" {}", opt_regex(#regex, &mut last_command));
|
||||
let opts = quote! {
|
||||
let caps = opt_regex(#regex, &mut last_command);
|
||||
let #token_tag = {
|
||||
if caps.is_empty() {
|
||||
"".to_string()
|
||||
} else {
|
||||
format!(" {}", caps)
|
||||
}
|
||||
};
|
||||
};
|
||||
opt_list.push(command);
|
||||
opt_list.push(opts);
|
||||
|
||||
replace_list.push(rtag(tag_name, replace_tag, ¤t_tag));
|
||||
suggest.replace_range(placeholder, ¤t_tag);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ suggest = [
|
|||
'''
|
||||
#[err_contains(no such file or directory)]
|
||||
mkdir -p {{cmd::(?m)\s(\S+[\\\/])\S*\s*$}} && \
|
||||
{{command[0]}} {{opt::\s(-[\w]+)}} {{command[1:]}} '''
|
||||
{{command[0]}} {{opt::(?:\s)(-[\w]+)}} {{command[1:]}} '''
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use crate::files::*;
|
||||
use regex_lite::Regex;
|
||||
use itertools::Itertools;
|
||||
use regex_lite::Regex;
|
||||
|
||||
fn regex_captures(regex: &str, string: &str) -> Vec<String> {
|
||||
let regex = Regex::new(regex).unwrap();
|
||||
|
|
@ -158,7 +158,7 @@ pub fn find_similars(
|
|||
if !min_distance_index.is_empty() {
|
||||
min_distance_index.push(i)
|
||||
}
|
||||
},
|
||||
}
|
||||
Less => {
|
||||
min_distance = distance;
|
||||
min_distance_index.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue