mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 15:45:11 +01:00
fix: modules
This commit is contained in:
parent
5aebf867c1
commit
fedee1dc8d
12 changed files with 54 additions and 39 deletions
|
|
@ -1,16 +1,25 @@
|
|||
mod replaces;
|
||||
mod rules;
|
||||
|
||||
fn main() -> Result<(), std::io::Error>{
|
||||
let executable = std::env::var("_PR_COMMAND").unwrap();
|
||||
let shell = std::env::var("_PR_SHELL").unwrap();
|
||||
let last_command = std::env::var("_PR_LAST_COMMAND").unwrap();
|
||||
let error_msg = std::env::var("_PR_ERROR_MSG").unwrap();
|
||||
fn main() -> Result<(), std::io::Error> {
|
||||
let executable = std::env::var("_PR_COMMAND").expect("_PR_COMMAND not set");
|
||||
let shell = std::env::var("_PR_SHELL").expect("_PR_SHELL not set");
|
||||
let last_command = std::env::var("_PR_LAST_COMMAND").expect("_PR_LAST_COMMAND not set");
|
||||
let error_msg = std::env::var("_PR_ERROR_MSG").expect("_PR_ERROR_MSG not set");
|
||||
let executables: Vec<String> = {
|
||||
let executables = std::env::var("_PR_EXECUTABLES").unwrap();
|
||||
let executables = std::env::var("_PR_EXECUTABLES").expect("_PR_EXECUTABLES not set");
|
||||
executables.split(",").map(|s| s.to_string()).collect()
|
||||
};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
eprintln!("shell: {}", shell);
|
||||
eprintln!("executable: {}", executable);
|
||||
eprintln!("last_command: {}", last_command);
|
||||
eprintln!("error_msg: {}", error_msg);
|
||||
eprintln!("executables: {:?}", executables);
|
||||
}
|
||||
|
||||
rules::runtime_match(&executable, &shell, &last_command, &error_msg, &executables);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,4 +183,3 @@ pub fn shell(suggest: &mut String, shell: &str) {
|
|||
suggest.replace_range(placeholder, &command.join("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct MatchError {
|
|||
}
|
||||
|
||||
pub fn runtime_match(
|
||||
executable: &str,
|
||||
executable: &str,
|
||||
shell: &str,
|
||||
last_command: &str,
|
||||
error_msg: &str,
|
||||
|
|
@ -83,16 +83,11 @@ pub fn runtime_match(
|
|||
if pure_suggest.contains("{{command}}") {
|
||||
pure_suggest = pure_suggest.replace("{{command}}", last_command);
|
||||
}
|
||||
print!("{}",
|
||||
eval_suggest(
|
||||
&pure_suggest,
|
||||
last_command,
|
||||
error_msg,
|
||||
executables,
|
||||
shell,
|
||||
)
|
||||
print!(
|
||||
"{}",
|
||||
eval_suggest(&pure_suggest, last_command, error_msg, executables, shell,)
|
||||
);
|
||||
print!("{}", "<_PR_BR>");
|
||||
print!("<_PR_BR>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -194,4 +189,3 @@ fn get_rule(executable: &str) -> Option<String> {
|
|||
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue