Add generated code warning for Nushell

This commit is contained in:
Ajeet D'Souza 2021-08-05 14:22:12 +05:30
parent 3efc0c6f2f
commit 05a95fe525
4 changed files with 45 additions and 41 deletions

View File

@ -4,7 +4,7 @@
> A smarter cd command for your terminal > A smarter cd command for your terminal
[![crates.io][crates-io-badge]][crates-io] [![crates.io][crates-io-badge]][crates.io]
[![Releases][releases-badge]][releases] [![Releases][releases-badge]][releases]
`zoxide` is a blazing fast replacement for your `cd` command, inspired by `zoxide` is a blazing fast replacement for your `cd` command, inspired by
@ -49,7 +49,7 @@ Alternatively, you can use a package manager:
| Distribution | Repository | Instructions | | Distribution | Repository | Instructions |
| ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------- | | ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------- |
| ***Any*** | **[crates-io]** | `cargo install zoxide` | | ***Any*** | **[crates.io]** | `cargo install zoxide` |
| *Any* | [conda-forge] | `conda install -c conda-forge zoxide` | | *Any* | [conda-forge] | `conda install -c conda-forge zoxide` |
| *Any* | [Linuxbrew] | `brew install zoxide` | | *Any* | [Linuxbrew] | `brew install zoxide` |
| Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` | | Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` |
@ -73,7 +73,7 @@ To install `zoxide`, use a package manager:
| Repository | Instructions | | Repository | Instructions |
| --------------- | ------------------------------------- | | --------------- | ------------------------------------- |
| **[crates-io]** | `cargo install zoxide` | | **[crates.io]** | `cargo install zoxide` |
| [conda-forge] | `conda install -c conda-forge zoxide` | | [conda-forge] | `conda install -c conda-forge zoxide` |
| [Homebrew] | `brew install zoxide` | | [Homebrew] | `brew install zoxide` |
| [MacPorts] | `port install zoxide` | | [MacPorts] | `port install zoxide` |
@ -93,7 +93,7 @@ Alternatively, you can use a package manager:
| Repository | Instructions | | Repository | Instructions |
| --------------- | ------------------------------------- | | --------------- | ------------------------------------- |
| **[crates-io]** | `cargo install zoxide` | | **[crates.io]** | `cargo install zoxide` |
| [Chocolatey] | `choco install zoxide` | | [Chocolatey] | `choco install zoxide` |
| [conda-forge] | `conda install -c conda-forge zoxide` | | [conda-forge] | `conda install -c conda-forge zoxide` |
| [Scoop] | `scoop install zoxide` | | [Scoop] | `scoop install zoxide` |
@ -107,7 +107,7 @@ To install `zoxide`, use a package manager:
| Distribution | Repository | Instructions | | Distribution | Repository | Instructions |
| ------------- | --------------- | ---------------------- | | ------------- | --------------- | ---------------------- |
| ***Any*** | **[crates-io]** | `cargo install zoxide` | | ***Any*** | **[crates.io]** | `cargo install zoxide` |
| DragonFly BSD | [DPorts] | `pkg install zoxide` | | DragonFly BSD | [DPorts] | `pkg install zoxide` |
| FreeBSD | [FreshPorts] | `pkg install zoxide` | | FreeBSD | [FreshPorts] | `pkg install zoxide` |
| NetBSD | [pkgsrc] | `pkgin install zoxide` | | NetBSD | [pkgsrc] | `pkgin install zoxide` |
@ -125,35 +125,7 @@ To install `zoxide`, use a package manager:
</details> </details>
### *Step 2: Install `fzf` (optional)* ### *Step 2: Add `zoxide` to your shell*
[`fzf`][fzf] is a command-line fuzzy finder, used by `zoxide` for interactive
selection. It can be installed from [here][fzf-installation].
### *Step 3: Import your data (optional)*
If you currently use any of the following utilities, you may want to import
your data into `zoxide`:
<details>
<summary><code>autojump</code></summary>
```sh
zoxide import --from autojump path/to/db
```
</details>
<details>
<summary><code>z</code>, <code>z.lua</code>, or <code>zsh-z</code></summary>
```sh
zoxide import --from z path/to/db
```
</details>
### *Step 4: Add `zoxide` to your shell*
To start using `zoxide`, add it to your shell. To start using `zoxide`, add it to your shell.
@ -199,7 +171,7 @@ Initialize the `zoxide` script:
zoxide init nushell --hook prompt | save ~/.zoxide.nu zoxide init nushell --hook prompt | save ~/.zoxide.nu
``` ```
Add this to your configuration (usually `~/.config/nu/config.toml`): Add this to your configuration (find it by running `config path` in Nushell):
```toml ```toml
prompt = "__zoxide_hook;__zoxide_prompt" prompt = "__zoxide_hook;__zoxide_prompt"
@ -213,7 +185,8 @@ You can replace `__zoxide_prompt` with a custom prompt.
<details> <details>
<summary><code>powershell</code></summary> <summary><code>powershell</code></summary>
Add this to your configuration (find it with `echo $profile`): Add this to your configuration (find it by running `echo $profile` in
PowerShell):
```powershell ```powershell
Invoke-Expression (& { Invoke-Expression (& {
@ -257,6 +230,34 @@ eval "$(zoxide init posix --hook prompt)"
</details> </details>
### *Step 3: Install `fzf` (optional)*
[`fzf`][fzf] is a command-line fuzzy finder, used by `zoxide` for interactive
selection. It can be installed from [here][fzf-installation].
### *Step 4: Import your data (optional)*
If you currently use any of the following utilities, you may want to import
your data into `zoxide`:
<details>
<summary><code>autojump</code></summary>
```sh
zoxide import --from autojump path/to/db
```
</details>
<details>
<summary><code>z</code>, <code>z.lua</code>, or <code>zsh-z</code></summary>
```sh
zoxide import --from z path/to/db
```
</details>
## Configuration ## Configuration
### Flags ### Flags
@ -338,7 +339,7 @@ Be sure to set these before calling `zoxide init`.
[conda-forge]: https://anaconda.org/conda-forge/zoxide [conda-forge]: https://anaconda.org/conda-forge/zoxide
[copr]: https://copr.fedorainfracloud.org/coprs/atim/zoxide/ [copr]: https://copr.fedorainfracloud.org/coprs/atim/zoxide/
[crates-io-badge]: https://img.shields.io/crates/v/zoxide [crates-io-badge]: https://img.shields.io/crates/v/zoxide
[crates-io]: https://crates.io/crates/zoxide [crates.io]: https://crates.io/crates/zoxide
[debian packages]: https://packages.debian.org/testing/admin/zoxide [debian packages]: https://packages.debian.org/testing/admin/zoxide
[devuan packages]: https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=zoxide [devuan packages]: https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=zoxide
[dports]: https://github.com/DragonFlyBSD/DPorts/tree/master/sysutils/zoxide [dports]: https://github.com/DragonFlyBSD/DPorts/tree/master/sysutils/zoxide

View File

@ -34,7 +34,8 @@ Create a Nushell script:
\fBzoxide init nushell --hook prompt | save ~/.zoxide.nu\fR \fBzoxide init nushell --hook prompt | save ~/.zoxide.nu\fR
.fi .fi
.sp .sp
Add this to your configuration (usually \fI~/.config/nu/config.toml\fR): Add this to your configuration (find it by running \fBconfig path\fR in
Nushell):
.sp .sp
.nf .nf
\fBprompt = "__zoxide_hook;__zoxide_prompt"\fR \fBprompt = "__zoxide_hook;__zoxide_prompt"\fR

View File

@ -1,6 +1,8 @@
{%- let section = "# =============================================================================\n#" -%} {%- let section = "# =============================================================================\n#" -%}
{%- let not_configured = "# -- not configured --" -%} {%- let not_configured = "# -- not configured --" -%}
# Code generated by zoxide. DO NOT EDIT.
{{ section }} {{ section }}
# Utility functions for zoxide. # Utility functions for zoxide.
# #
@ -97,7 +99,7 @@ alias {{cmd}}i = __zoxide_zi
# #
# zoxide init nushell --hook prompt | save ~/.zoxide.nu # zoxide init nushell --hook prompt | save ~/.zoxide.nu
# #
# Add this to your configuration (usually ~/.config/nu/config.toml): # Add this to your configuration (find it by running `config path` in Nushell):
# #
# prompt = '__zoxide_hook;__zoxide_prompt' # prompt = '__zoxide_hook;__zoxide_prompt'
# startup = ['zoxide init nushell --hook prompt | save ~/.zoxide.nu', 'source ~/.zoxide.nu'] # startup = ['zoxide init nushell --hook prompt | save ~/.zoxide.nu', 'source ~/.zoxide.nu']

View File

@ -115,7 +115,7 @@ Set-Alias {{cmd}}i __zoxide_zi
{%- endmatch %} {%- endmatch %}
{{ section }} {{ section }}
# To initialize zoxide, add this to your configuration (find it with # To initialize zoxide, add this to your configuration (find it by running
# `echo $profile`): # `echo $profile` in PowerShell):
# #
# Invoke-Expression (& { $hook = if ($PSVersionTable.PSVersion.Major -ge 6) { 'pwd' } else { 'prompt' } (zoxide init powershell --hook $hook) -join "`n" }) # Invoke-Expression (& { $hook = if ($PSVersionTable.PSVersion.Major -ge 6) { 'pwd' } else { 'prompt' } (zoxide init powershell --hook $hook) -join "`n" })