From 45540a7c957922d6f5143836d4d74873dd578867 Mon Sep 17 00:00:00 2001 From: STEVAN Antoine <antoine.stevan@isae-supaero.fr> Date: Wed, 29 May 2024 09:24:27 +0000 Subject: [PATCH] make `.nushell/` a proper module (dragoon/komodo!123) this MR turns `./.nushell/` into a directory module by - adding `mod.nu` - exporting all the modules all uses of `.nushell/` have been fixed to not mention `.nu` internal modules anymore. > :bulb: **Note** > the `.nushell venv` module has been removed because, when the `$venv.VENV` activation script is not there, Nushell can't parse the whole `.nushell` module, which is very annoying to have to rely of the state of the external filesystem to be able to simply parse a module... --- .nushell/mod.nu | 9 +++++++++ .nushell/plot.nu | 3 --- .nushell/venv.nu | 1 - README.md | 2 +- benchmarks/.nushell/commit/plot.nu | 6 +++--- benchmarks/.nushell/fec/plot.nu | 8 ++++---- benchmarks/.nushell/fec/run.nu | 2 +- benchmarks/.nushell/recoding/plot.nu | 8 ++++---- benchmarks/.nushell/recoding/run.nu | 2 +- benchmarks/.nushell/setup/plot.nu | 6 +++--- bins/inbreeding/plot.nu | 6 +++--- bins/inbreeding/run.nu | 2 +- examples/cli.nu | 2 +- komodo.nu | 2 +- tests/binary.nu | 2 +- tests/cli.nu | 2 +- tests/color.nu | 2 +- 17 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 .nushell/mod.nu delete mode 100644 .nushell/venv.nu diff --git a/.nushell/mod.nu b/.nushell/mod.nu new file mode 100644 index 00000000..c6e1c6a9 --- /dev/null +++ b/.nushell/mod.nu @@ -0,0 +1,9 @@ +export module binary.nu +export module cargo.nu +export module color.nu +export module error.nu +export module formats.nu +export module fs.nu +export module math.nu +export module parse.nu +export module plot.nu diff --git a/.nushell/plot.nu b/.nushell/plot.nu index 76d5c7dc..b31a4058 100644 --- a/.nushell/plot.nu +++ b/.nushell/plot.nu @@ -1,5 +1,3 @@ -use venv.nu VENV - export const COMMON_OPTIONS = [ --x-scale log --x-scale-base 2 @@ -70,6 +68,5 @@ export def into-axis-options [-x: string, -y: string]: table<x: float, y: float> } export def --wrapped gplt [...args: string] { - overlay use $VENV ^gplt ...$args } diff --git a/.nushell/venv.nu b/.nushell/venv.nu deleted file mode 100644 index 38a6002b..00000000 --- a/.nushell/venv.nu +++ /dev/null @@ -1 +0,0 @@ -export const VENV = ($nu.home-path | path join ".local/share/venvs/gplt/bin/activate.nu") diff --git a/README.md b/README.md index ae38c5eb..35f4be8d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Komodo provides a bunch of other binaries that might be interesting of useful to The easiest is to use the `cargo.nu` Nushell module as follows ```bash -use .nushell/cargo.nu "cargo bin" +use .nushell cargo "cargo bin" help cargo bin ``` diff --git a/benchmarks/.nushell/commit/plot.nu b/benchmarks/.nushell/commit/plot.nu index c0b9e95b..576b200f 100644 --- a/benchmarks/.nushell/commit/plot.nu +++ b/benchmarks/.nushell/commit/plot.nu @@ -1,6 +1,6 @@ -use ../../../.nushell/math.nu * -use ../../../.nushell/fs.nu check-file -use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS, gplt ] +use ../../../.nushell math * +use ../../../.nushell fs check-file +use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ] export def main [data: path, --save: path] { check-file $data --span (metadata $data).span diff --git a/benchmarks/.nushell/fec/plot.nu b/benchmarks/.nushell/fec/plot.nu index 1d6efeb6..9ed47a41 100644 --- a/benchmarks/.nushell/fec/plot.nu +++ b/benchmarks/.nushell/fec/plot.nu @@ -1,7 +1,7 @@ -use ../../../.nushell/math.nu * -use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS ] -use ../../../.nushell/fs.nu check-file -use ../../../.nushell/plot.nu gplt +use ../../../.nushell math * +use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS ] +use ../../../.nushell fs check-file +use ../../../.nushell plot gplt export def encoding [data: path, --save: path] { check-file $data --span (metadata $data).span diff --git a/benchmarks/.nushell/fec/run.nu b/benchmarks/.nushell/fec/run.nu index 8eccebec..ceafe8ad 100644 --- a/benchmarks/.nushell/fec/run.nu +++ b/benchmarks/.nushell/fec/run.nu @@ -1,4 +1,4 @@ -use ../../../.nushell/formats.nu * +use ../../../.nushell formats * export def main [ --output: path = "./fec.ndjson", diff --git a/benchmarks/.nushell/recoding/plot.nu b/benchmarks/.nushell/recoding/plot.nu index 64657f1a..ccc32ec2 100644 --- a/benchmarks/.nushell/recoding/plot.nu +++ b/benchmarks/.nushell/recoding/plot.nu @@ -1,7 +1,7 @@ -use ../../../.nushell/math.nu * -use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS ] -use ../../../.nushell/fs.nu check-file -use ../../../.nushell/plot.nu gplt +use ../../../.nushell math * +use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS ] +use ../../../.nushell fs check-file +use ../../../.nushell plot gplt export def main [data: path, --save: path] { check-file $data --span (metadata $data).span diff --git a/benchmarks/.nushell/recoding/run.nu b/benchmarks/.nushell/recoding/run.nu index 0bd79e73..9b42ae72 100644 --- a/benchmarks/.nushell/recoding/run.nu +++ b/benchmarks/.nushell/recoding/run.nu @@ -1,4 +1,4 @@ -use ../../../.nushell/formats.nu * +use ../../../.nushell formats * export def main [ --output: path = "./recoding.ndjson", diff --git a/benchmarks/.nushell/setup/plot.nu b/benchmarks/.nushell/setup/plot.nu index c2ce80e4..c0ff7b9f 100644 --- a/benchmarks/.nushell/setup/plot.nu +++ b/benchmarks/.nushell/setup/plot.nu @@ -1,6 +1,6 @@ -use ../../../.nushell/math.nu * -use ../../../.nushell/fs.nu check-file -use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS, gplt ] +use ../../../.nushell math * +use ../../../.nushell fs check-file +use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ] export def main [data: path, --save: path] { check-file $data --span (metadata $data).span diff --git a/bins/inbreeding/plot.nu b/bins/inbreeding/plot.nu index 189b09fd..abb10a24 100644 --- a/bins/inbreeding/plot.nu +++ b/bins/inbreeding/plot.nu @@ -1,9 +1,9 @@ use std repeat use consts.nu -use ../../.nushell/plot.nu gplt -use ../../.nushell/color.nu * -use ../../.nushell/error.nu "error throw" +use ../../.nushell plot gplt +use ../../.nushell color * +use ../../.nushell error "error throw" def "parse strategy" []: string -> record<type: string> { let s = $in diff --git a/bins/inbreeding/run.nu b/bins/inbreeding/run.nu index 920b0a19..f18f72c1 100644 --- a/bins/inbreeding/run.nu +++ b/bins/inbreeding/run.nu @@ -1,5 +1,5 @@ use consts.nu -use ../../.nushell/cargo.nu "cargo bin" +use ../../.nushell cargo "cargo bin" export def main [ --options: record< diff --git a/examples/cli.nu b/examples/cli.nu index c0cc5c72..12b75025 100755 --- a/examples/cli.nu +++ b/examples/cli.nu @@ -7,7 +7,7 @@ use ../komodo.nu [ "komodo reconstruct", "komodo ls", ] -use ../.nushell/binary.nu [ "bytes from_int" ] +use ../.nushell binary [ "bytes from_int" ] use std assert diff --git a/komodo.nu b/komodo.nu index f0addc70..38b51c1a 100644 --- a/komodo.nu +++ b/komodo.nu @@ -2,7 +2,7 @@ # # please run `komodo --help` or `komodo <tab>` to have a look at more information -use .nushell/binary.nu ["bytes from_int"] +use .nushell binary ["bytes from_int"] const KOMODO_BINARY = "./target/release/komodo" const DEFAULT_LOG_LEVEL = "INFO" diff --git a/tests/binary.nu b/tests/binary.nu index 8f45732e..1cb755f6 100644 --- a/tests/binary.nu +++ b/tests/binary.nu @@ -1,4 +1,4 @@ -use ../.nushell/binary.nu [ +use ../.nushell binary [ "bytes decode", "bytes encode", "bytes from_int", "bytes to_int" ] diff --git a/tests/cli.nu b/tests/cli.nu index 637fcb8f..fd149dff 100644 --- a/tests/cli.nu +++ b/tests/cli.nu @@ -7,7 +7,7 @@ use ../komodo.nu [ "komodo ls", "komodo clean", ] -use ../.nushell/binary.nu [ "bytes from_int" ] +use ../.nushell binary [ "bytes from_int" ] use std assert diff --git a/tests/color.nu b/tests/color.nu index 0374a9ea..27609447 100644 --- a/tests/color.nu +++ b/tests/color.nu @@ -1,4 +1,4 @@ -use ../.nushell/color.nu [ +use ../.nushell color [ "color from-floats", "color from-ints", "color from-string", -- GitLab