mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 15:45:11 +01:00
fix: bash & zsh initiliazation
This commit is contained in:
parent
008ac32d96
commit
2680a1609b
1 changed files with 9 additions and 8 deletions
|
|
@ -312,6 +312,7 @@ pub fn run_mode() -> Mode {
|
||||||
|
|
||||||
pub fn alias_map(shell: &str) -> Option<HashMap<String, String>> {
|
pub fn alias_map(shell: &str) -> Option<HashMap<String, String>> {
|
||||||
let env = std::env::var("_PR_ALIAS");
|
let env = std::env::var("_PR_ALIAS");
|
||||||
|
|
||||||
if env.is_err() {
|
if env.is_err() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
@ -392,11 +393,11 @@ pub fn initialization(init: &mut Init) {
|
||||||
match init.shell.as_str() {
|
match init.shell.as_str() {
|
||||||
"bash" => {
|
"bash" => {
|
||||||
last_command = "$(history 2)";
|
last_command = "$(history 2)";
|
||||||
shell_alias = "$(alias)"
|
shell_alias = "`alias`";
|
||||||
}
|
}
|
||||||
"zsh" => {
|
"zsh" => {
|
||||||
last_command = "$(fc -ln -1)";
|
last_command = "$(fc -ln -1)";
|
||||||
shell_alias = "$(alias)"
|
shell_alias = "`alias`";
|
||||||
}
|
}
|
||||||
"fish" => {
|
"fish" => {
|
||||||
last_command = "$(history | head -n 1)";
|
last_command = "$(history | head -n 1)";
|
||||||
|
|
@ -511,36 +512,36 @@ end
|
||||||
initialize = format!(
|
initialize = format!(
|
||||||
r#"
|
r#"
|
||||||
command_not_found_handle() {{
|
command_not_found_handle() {{
|
||||||
eval $(_PR_LAST_COMMAND="_ $@" _PR_SHELL="{}" _PR_MODE="cnf" "{}")
|
eval $(_PR_LAST_COMMAND="_ $@" _PR_SHELL="{}" _PR_ALIAS="{}" _PR_MODE="cnf" "{}")
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{}
|
{}
|
||||||
"#,
|
"#,
|
||||||
shell, binary_path, initialize
|
shell, shell_alias, binary_path, initialize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"zsh" => {
|
"zsh" => {
|
||||||
initialize = format!(
|
initialize = format!(
|
||||||
r#"
|
r#"
|
||||||
command_not_found_handler() {{
|
command_not_found_handler() {{
|
||||||
eval $(_PR_LAST_COMMAND="$@" _PR_SHELL="{}" _PR_MODE="cnf" "{}")
|
eval $(_PR_LAST_COMMAND="$@" _PR_SHELL="{}" _PR_ALIAS="{}" _PR_MODE="cnf" "{}")
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{}
|
{}
|
||||||
"#,
|
"#,
|
||||||
shell, binary_path, initialize
|
shell, shell_alias, binary_path, initialize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"fish" => {
|
"fish" => {
|
||||||
initialize = format!(
|
initialize = format!(
|
||||||
r#"
|
r#"
|
||||||
function fish_command_not_found --on-event fish_command_not_found
|
function fish_command_not_found --on-event fish_command_not_found
|
||||||
eval $(_PR_LAST_COMMAND="$argv" _PR_SHELL="{}" _PR_MODE="cnf" "{}")
|
eval $(_PR_LAST_COMMAND="$argv" _PR_SHELL="{}" _PR_ALIAS="{}" _PR_MODE="cnf" "{}")
|
||||||
end
|
end
|
||||||
|
|
||||||
{}
|
{}
|
||||||
"#,
|
"#,
|
||||||
shell, binary_path, initialize
|
shell, shell_alias, binary_path, initialize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"pwsh" => {
|
"pwsh" => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue