mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
chore: prioritize module suggestions
This commit is contained in:
parent
65213efb3b
commit
d044164f26
2 changed files with 13 additions and 13 deletions
|
|
@ -21,18 +21,6 @@ pub fn suggest_candidates(data: &mut Data) {
|
||||||
let modules = &data.modules;
|
let modules = &data.modules;
|
||||||
let fallbacks = &data.fallbacks;
|
let fallbacks = &data.fallbacks;
|
||||||
|
|
||||||
if privilege.is_none() {
|
|
||||||
if let Some(candidates) = match_pattern("_PR_privilege", data) {
|
|
||||||
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(candidates) = match_pattern(executable, data) {
|
|
||||||
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
|
||||||
}
|
|
||||||
if let Some(candidates) = match_pattern("_PR_general", data) {
|
|
||||||
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
eprintln!("modules: {modules:?}");
|
eprintln!("modules: {modules:?}");
|
||||||
|
|
@ -47,6 +35,18 @@ pub fn suggest_candidates(data: &mut Data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if privilege.is_none() {
|
||||||
|
if let Some(candidates) = match_pattern("_PR_privilege", data) {
|
||||||
|
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(candidates) = match_pattern(executable, data) {
|
||||||
|
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
||||||
|
}
|
||||||
|
if let Some(candidates) = match_pattern("_PR_general", data) {
|
||||||
|
add_candidates_no_dup(command, &mut suggest_candidates, &candidates);
|
||||||
|
}
|
||||||
|
|
||||||
if !suggest_candidates.is_empty() {
|
if !suggest_candidates.is_empty() {
|
||||||
data.candidates = suggest_candidates;
|
data.candidates = suggest_candidates;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ There are 2 types of modules:
|
||||||
- **CAUTION**: Will immediately return if a suggestion is obtained
|
- **CAUTION**: Will immediately return if a suggestion is obtained
|
||||||
- Naming convention: `_pay-respects-fallback-<priority>-<your module name>`
|
- Naming convention: `_pay-respects-fallback-<priority>-<your module name>`
|
||||||
|
|
||||||
Priority is used to retrieve suggestions in a specific order by an [unstable sort](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable) (although they will always be after compile-time matches). Default modules have a priority of `100`.
|
Priority is used to retrieve suggestions in a specific order by an [unstable sort](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable). Default modules have a priority of `100`.
|
||||||
|
|
||||||
When running your module, you will get the following environment variables:
|
When running your module, you will get the following environment variables:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue