Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a helper module to install Nushell dependencies #66

Merged
merged 3 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A fast *interactive explorer* tool for *structured data* inspired by [`nu-explor
- [*an example*](#an-example)
- [*some convenience*](#-some-convenience)
- [*see the documentation locally*](#see-the-documentation-locally)
- [*troubleshooting*](#troubleshooting)
- [*contributing*](#contributing)
- [*TODO*](#todo)
- [*features*](#features)
Expand All @@ -41,6 +42,13 @@ will come very handy in a day-to-day basis for me at least :)
so here we are... LET'S GO :muscle:

# installation
> **Important**
> if you are using bleeding-edge versions of Nushell, please make sure the
> Nushell dependencies are the same as your Nushell install by running
> ```nushell
> use scripts/deps.nu; deps --current
> ```

## using `nupm install` (recommended)
- download [nushell/nupm](https://github.com/nushell/nupm)
- load the `nupm` module
Expand Down Expand Up @@ -110,6 +118,20 @@ and voila :yum:
cargo doc --document-private-items --no-deps --open
```

# troubleshooting
in case you get some weird error or behaviour, before filing any issue, the
easiest is to make sure the plugin is compiled with the same revision as the
Nushell you are using!
```nushell
use scripts/deps.nu; deps --current
```
and then you can come back to the [*installation*](#installation) section.

> **Note**
> of course, this will not work if the version of Nushell you are using is too
> old, because then the state of `nu_plugin_explore` will be too recent for
> everything to compile properly...

# contributing
in order to help, you can have a look at
- the [todo](#todo) list down below, there might be unticked tasks to tackle
Expand Down
36 changes: 36 additions & 0 deletions scripts/deps.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const NUSHELL_REMOTE = "https://github.com/nushell/nushell"
const PKGS = [ "nuon", "nu-protocol", "nu-plugin" ]

# setup Nushell dependencies
#
# > **Note**
# > options are shown in inverse order of precedence
export def main [
--rev: string, # a Nushell revision
--tag: string, # a Nushell tag
--current, # use the current Nushell version
] {
let opts = if $current {
if (version).commit_hash != null {
print $"using current revision of Nushell: (version | get commit_hash)"
[ --rev (version).commit_hash ]
} else {
print $"using current version of Nushell: (version | get version)"
[ --tag (version).version ]
}
} else {
if $tag != null {
print $"using user version: ($tag)"
[ --tag $tag ]
} else if $rev != null {
print $"using user revision: ($rev)"
[ --rev $rev ]
} else {
error make --unspanned { msg: "please give either `--rev` or `--tag`" }
}
}

for pkg in $PKGS {
cargo add $pkg --git $NUSHELL_REMOTE ...$opts
}
}
Loading