feat: partial nushell support

This commit is contained in:
iff 2023-07-31 15:06:30 +02:00
parent 48062142c6
commit 86ae6a6fb4
3 changed files with 16 additions and 1 deletions

View file

@ -15,7 +15,12 @@ alias f="$(pay_respect zsh)"
```
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

View file

@ -19,6 +19,15 @@ pub fn handle_args() {
last_command = "$(history | head -n 1)";
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);
std::process::exit(1);

View file

@ -27,6 +27,7 @@ fn last_command(shell: &str) -> String {
}
"zsh" => last_command,
"fish" => last_command,
"nu" => last_command,
_ => {
eprintln!("Unsupported shell: {}", shell);
exit(1);