docs: update with latest nushell install

This commit is contained in:
iff 2024-11-18 14:16:01 +01:00
parent 9c8cf93917
commit 9a8bebdb86

128
README.md
View file

@ -13,75 +13,115 @@ Typed a wrong command? Pay Respects will try to correct your wrong console comma
## How to Pay Respects ## How to Pay Respects
The binary is named `pay-respects`, by adding an alias to your shell Please follow the instruction for your shell:
configuration:
<details>
<summary>Base / Zsh</summary>
Manual aliasing:
``` shell ``` shell
# Note: You may need to have the binary exposed in your path alias f="$(pay-respects bash)"
alias f="$(pay-respects <your_shell_here>)"
# for example, using `zsh`:
alias f="$(pay-respects zsh)" alias f="$(pay-respects zsh)"
# Alternatively, you can also use the following initialization in your config file
# for bash and zsh
eval "$(pay-respects <shell> --alias)"
# for fish
pay-respects fish --alias | source
# for `nushell`, the alias can be added automatically with:
pay-respects nushell
``` ```
Auto aliasing (optional custom alias can be added after `--alias argument`):
``` shell
eval "$(pay-respects bash --alias)"
eval "$(pay-respects zsh --alias)"
```
</details>
<details>
<summary>Fish</summary>
Manual aliasing:
``` shell
alias f="$(pay-respects fish)"
```
Auto aliasing (optional custom alias can be added after `--alias argument`):
``` shell
pay-respects fish --alias | source
```
</details>
<details>
<summary>Nushell</summary>
Add the output of the following file to your configuration file:
```
pay-respects nushell [--alias <alias>]
```
Or save it as a file:
```
pay-respects nushell [--alias <alias>] | save -f ~/.pay-respects.nu
```
and source from your config file:
```
source ~/.pay-respects.nu
```
</details>
You can now **press `F` to Pay Respects**! You can now **press `F` to Pay Respects**!
Currently, only corrections to `bash`, `zsh`, and `fish` are working flawlessly.
`nushell` is currently usable, but there is no alias expansion, and you will have to put the evaluated initialization command in your config file (added automatically with `pay-respects nushell`). In addition, commands that need to be evaluated in the current working shell (such as `cd`) cannot yet be implemented in `nushell`.
Shell is not obtained automatically through environment variables because it won't work with nested shells, e.g. `fish` inside `zsh` still has `SHELL=zsh`.
## Installing ## Installing
Install from your package manager if available: Install from your package manager if available:
[![Packaging status](https://repology.org/badge/vertical-allrepos/pay-respects.svg)](https://repology.org/project/pay-respects/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/pay-respects.svg)](https://repology.org/project/pay-respects/versions)
For generic x86 Linux desktop, you can get the binary from [releases](https://github.com/iffse/pay-respects/releases). <details>
<summary>Generic x86 Desktop Linux</summary>
1. Get the latest binary from [releases](https://github.com/iffse/pay-respects/releases).
```shell ```shell
# download latest release
curl -sL -o pay-respects.zip \ curl -sL -o pay-respects.zip \
$(curl -s https://api.github.com/repos/iffse/pay-respects/releases/latest \ $(curl -s https://api.github.com/repos/iffse/pay-respects/releases/latest \
| sed 's/[()",{}]/ /g; s/ /\n/g' \ | sed 's/[()",{}]/ /g; s/ /\n/g' \
| grep "https.*pay-respects-ubuntu-latest.zip") | grep "https.*pay-respects-ubuntu-latest.zip")
# extract zip, e.g. one of the following
7z -x pay-respects.zip
unzip pay-respects.zip
# system-wide installation
sudo chmod a+x pay-respects
sudo mv pay-respects /usr/local/bin/pay-respects
# delete downloaded package
rm pay-respects.zip
``` ```
If you have cargo installed, you can compile it from source (should work regardless of operating system or architecture): 2. Extract zip, e.g. one of the following:
```shell ```shell
# install from crates.io 7z -x pay-respects.zip
# enabling runtime-rules is optional unzip pay-respects.zip
cargo install pay-respects --features=runtime-rules ```
# clone from git and install 3. System-wide installation:
# suitable for adding custom compile-time rules ```shell
sudo chmod a+x pay-respects
sudo mv pay-respects /usr/local/bin/pay-respects
```
4. Delete the downloaded package:
```shell
rm pay-respects.zip
```
</details>
<details>
<summary>Compile from source (any OS/architecture)</summary>
This installation requires you to have Cargo (the Rust package manager) installed.
Install from [crates.io](https://crates.io/), `runtime-rules` is optional:
```shell
cargo install pay-respects --features=runtime-rules
```
Clone from git and install, suitable for adding custom compile-time rules:
```
git clone --depth 1 https://github.com/iffse/pay-respects git clone --depth 1 https://github.com/iffse/pay-respects
cd pay-respects cd pay-respects
cargo install --path . cargo install --path .
# compile without installing
# binary can be found at ./target/release/pay-respects
cargo build --release
``` ```
</details>
## Rule Files ## Rule Files
See [writing rules](./rules.md) for how to write rules. See [writing rules](./rules.md) for how to write rules.