mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 07:35:10 +01:00
feat: partial nushell support
This commit is contained in:
parent
48062142c6
commit
86ae6a6fb4
3 changed files with 16 additions and 1 deletions
|
|
@ -15,7 +15,12 @@ alias f="$(pay_respect zsh)"
|
||||||
```
|
```
|
||||||
You can now **press `F` to Pay Respect**!
|
You can now **press `F` to Pay Respect**!
|
||||||
|
|
||||||
Currently, only corrections to `bash`, `zsh`, and `fish` are implemented.
|
Currently, only corrections to `bash`, `zsh`, and `fish` are working flawlessly.
|
||||||
|
|
||||||
|
`nushell` has broken aliases, therefore it has following 2 limitations:
|
||||||
|
|
||||||
|
- You have to manually add the output of `pay_respect nushell` to your configuration as alias
|
||||||
|
- Aliased commands cannot be expanded to their original command
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,15 @@ pub fn handle_args() {
|
||||||
last_command = "$(history | head -n 1)";
|
last_command = "$(history | head -n 1)";
|
||||||
alias = "$(alias)";
|
alias = "$(alias)";
|
||||||
}
|
}
|
||||||
|
"nu" | "nush" | "nushell"=> {
|
||||||
|
last_command = "(history | last).command";
|
||||||
|
alias = "\"\"";
|
||||||
|
println!("with-env {{ _PR_LAST_COMMAND : {},\
|
||||||
|
_PR_ALIAS : {},\
|
||||||
|
_PR_SHELL : {} }} \
|
||||||
|
{{ {} }}", last_command, alias, "nu", binary_path);
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!("Unknown shell: {}", shell);
|
println!("Unknown shell: {}", shell);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ fn last_command(shell: &str) -> String {
|
||||||
}
|
}
|
||||||
"zsh" => last_command,
|
"zsh" => last_command,
|
||||||
"fish" => last_command,
|
"fish" => last_command,
|
||||||
|
"nu" => last_command,
|
||||||
_ => {
|
_ => {
|
||||||
eprintln!("Unsupported shell: {}", shell);
|
eprintln!("Unsupported shell: {}", shell);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue