mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-03 08:05:10 +01:00
feat: multi-suggest
This commit is contained in:
parent
e6ed9d617b
commit
1ddfbef7e7
8 changed files with 111 additions and 81 deletions
|
|
@ -18,6 +18,7 @@ pub struct Data {
|
|||
pub shell: String,
|
||||
pub command: String,
|
||||
pub suggest: Option<String>,
|
||||
pub candidates: Vec<String>,
|
||||
pub split: Vec<String>,
|
||||
pub alias: Option<HashMap<String, String>>,
|
||||
pub privilege: Option<String>,
|
||||
|
|
@ -43,6 +44,7 @@ impl Data {
|
|||
shell,
|
||||
command,
|
||||
suggest: None,
|
||||
candidates: vec![],
|
||||
alias,
|
||||
split: vec![],
|
||||
privilege: None,
|
||||
|
|
@ -110,6 +112,13 @@ impl Data {
|
|||
self.suggest = Some(suggest.to_string());
|
||||
};
|
||||
}
|
||||
|
||||
pub fn add_candidate(&mut self, candidate: &str) {
|
||||
let candidate = candidate.trim();
|
||||
if candidate != self.command {
|
||||
self.candidates.push(candidate.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split_command(command: &str) -> Vec<String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue