mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 23:55:09 +01:00
refactor: use fc for bash
This commit is contained in:
parent
5791c2fc20
commit
0a799db5e5
2 changed files with 4 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Running standard modules in a separated thread
|
- Running standard modules in a separated thread
|
||||||
|
- Bash init: use `fc` instead of history
|
||||||
|
|
||||||
## [0.6.8] - 2025-01-02
|
## [0.6.8] - 2025-01-02
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -352,10 +352,7 @@ pub fn last_command(shell: &str) -> String {
|
||||||
};
|
};
|
||||||
|
|
||||||
match shell {
|
match shell {
|
||||||
"bash" => {
|
"bash" => last_command,
|
||||||
let first_line = last_command.lines().next().unwrap().trim();
|
|
||||||
first_line.split_once(' ').unwrap().1.to_string()
|
|
||||||
}
|
|
||||||
"zsh" => last_command,
|
"zsh" => last_command,
|
||||||
"fish" => last_command,
|
"fish" => last_command,
|
||||||
"nu" => last_command,
|
"nu" => last_command,
|
||||||
|
|
@ -456,7 +453,7 @@ pub fn initialization(init: &mut Init) {
|
||||||
|
|
||||||
match init.shell.as_str() {
|
match init.shell.as_str() {
|
||||||
"bash" => {
|
"bash" => {
|
||||||
last_command = "$(history 2)";
|
last_command = "$(fc -ln -1)";
|
||||||
shell_alias = "`alias`";
|
shell_alias = "`alias`";
|
||||||
}
|
}
|
||||||
"zsh" => {
|
"zsh" => {
|
||||||
|
|
@ -583,7 +580,7 @@ end
|
||||||
initialize = format!(
|
initialize = format!(
|
||||||
r#"
|
r#"
|
||||||
command_not_found_handle() {{
|
command_not_found_handle() {{
|
||||||
eval $(_PR_LAST_COMMAND="_ $@" _PR_SHELL="{}" _PR_ALIAS="{}" _PR_MODE="cnf" "{}")
|
eval $(_PR_LAST_COMMAND="$@" _PR_SHELL="{}" _PR_ALIAS="{}" _PR_MODE="cnf" "{}")
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue