From 92520b53c945a90f828dcc4b94f6a8b18e1eed0b Mon Sep 17 00:00:00 2001 From: STEVAN Antoine <antoine.stevan@isae-supaero.fr> Date: Mon, 3 Jun 2024 11:41:43 +0000 Subject: [PATCH] refactor "inbreeding" Nushell modules (dragoon/komodo!141) this MR - moves the Nushell modules from `bins/inbreeding/` to `bins/inbreeding/src/.nushell/` - creates a `NUSHELL` constant in `consts.nu` to allow the following more robust construct ```bash use consts.nu use $consts.NUSHELL ... ``` - updates the README --- bins/inbreeding/README.md | 8 ++++---- bins/inbreeding/mod.nu | 14 +++++++------- bins/inbreeding/{ => src/.nushell}/build.nu | 0 bins/inbreeding/{ => src/.nushell}/consts.nu | 2 ++ bins/inbreeding/{ => src/.nushell}/inspect.nu | 0 bins/inbreeding/{ => src/.nushell}/list.nu | 0 bins/inbreeding/{ => src/.nushell}/load.nu | 2 +- bins/inbreeding/{ => src/.nushell}/parse.nu | 0 bins/inbreeding/{ => src/.nushell}/path.nu | 0 bins/inbreeding/{ => src/.nushell}/plot.nu | 6 +++--- bins/inbreeding/{ => src/.nushell}/run.nu | 2 +- bins/inbreeding/{ => src/.nushell}/watch.nu | 0 12 files changed, 18 insertions(+), 16 deletions(-) rename bins/inbreeding/{ => src/.nushell}/build.nu (100%) rename bins/inbreeding/{ => src/.nushell}/consts.nu (72%) rename bins/inbreeding/{ => src/.nushell}/inspect.nu (100%) rename bins/inbreeding/{ => src/.nushell}/list.nu (100%) rename bins/inbreeding/{ => src/.nushell}/load.nu (98%) rename bins/inbreeding/{ => src/.nushell}/parse.nu (100%) rename bins/inbreeding/{ => src/.nushell}/path.nu (100%) rename bins/inbreeding/{ => src/.nushell}/plot.nu (97%) rename bins/inbreeding/{ => src/.nushell}/run.nu (98%) rename bins/inbreeding/{ => src/.nushell}/watch.nu (100%) diff --git a/bins/inbreeding/README.md b/bins/inbreeding/README.md index e747cd4f..32e32cac 100644 --- a/bins/inbreeding/README.md +++ b/bins/inbreeding/README.md @@ -1,6 +1,6 @@ -- build the example for best performance with [`inbreeding build`](./build.nu) -- run the experiment with [`inbreeding run`](./run.nu) -- plot the results with [`inbreeding plot`](./plot.nu) +- build the example for best performance with [`inbreeding build`](./src/.nushell/build.nu) +- run the experiment with [`inbreeding run`](./src/.nushell/run.nu) +- plot the results with [`inbreeding plot`](./src/.nushell/plot.nu) # Example ```bash @@ -42,7 +42,7 @@ inbreeding load $experiment | inbreeding plot ## plot all experiments ```bash -use bins/inbreeding/consts.nu CACHE +use bins/inbreeding/src/.nushell/consts.nu CACHE use bins/inbreeding const FIGURES_DIR = ($CACHE | path join figures) diff --git a/bins/inbreeding/mod.nu b/bins/inbreeding/mod.nu index 15e876c6..bb0b45a4 100644 --- a/bins/inbreeding/mod.nu +++ b/bins/inbreeding/mod.nu @@ -1,7 +1,7 @@ -export use build.nu -export use watch.nu -export use run.nu -export use inspect.nu -export use list.nu -export use load.nu -export use plot.nu +export use src/.nushell/build.nu +export use src/.nushell/watch.nu +export use src/.nushell/run.nu +export use src/.nushell/inspect.nu +export use src/.nushell/list.nu +export use src/.nushell/load.nu +export use src/.nushell/plot.nu diff --git a/bins/inbreeding/build.nu b/bins/inbreeding/src/.nushell/build.nu similarity index 100% rename from bins/inbreeding/build.nu rename to bins/inbreeding/src/.nushell/build.nu diff --git a/bins/inbreeding/consts.nu b/bins/inbreeding/src/.nushell/consts.nu similarity index 72% rename from bins/inbreeding/consts.nu rename to bins/inbreeding/src/.nushell/consts.nu index 177d568c..f7357d9d 100644 --- a/bins/inbreeding/consts.nu +++ b/bins/inbreeding/src/.nushell/consts.nu @@ -1,2 +1,4 @@ export const BIN = "./target/release/inbreeding" export const CACHE = ($nu.home-path | path join .cache komodo inbreeding) + +export const NUSHELL = "../../../../.nushell" diff --git a/bins/inbreeding/inspect.nu b/bins/inbreeding/src/.nushell/inspect.nu similarity index 100% rename from bins/inbreeding/inspect.nu rename to bins/inbreeding/src/.nushell/inspect.nu diff --git a/bins/inbreeding/list.nu b/bins/inbreeding/src/.nushell/list.nu similarity index 100% rename from bins/inbreeding/list.nu rename to bins/inbreeding/src/.nushell/list.nu diff --git a/bins/inbreeding/load.nu b/bins/inbreeding/src/.nushell/load.nu similarity index 98% rename from bins/inbreeding/load.nu rename to bins/inbreeding/src/.nushell/load.nu index 8581c85b..d410a90a 100644 --- a/bins/inbreeding/load.nu +++ b/bins/inbreeding/src/.nushell/load.nu @@ -1,7 +1,7 @@ use consts.nu use parse.nu [ "parse arg-experiment", "parse experiment" ] use path.nu [ "remove-cache-prefix" ] -use ../../.nushell error "error throw" +use $consts.NUSHELL error "error throw" use list.nu diff --git a/bins/inbreeding/parse.nu b/bins/inbreeding/src/.nushell/parse.nu similarity index 100% rename from bins/inbreeding/parse.nu rename to bins/inbreeding/src/.nushell/parse.nu diff --git a/bins/inbreeding/path.nu b/bins/inbreeding/src/.nushell/path.nu similarity index 100% rename from bins/inbreeding/path.nu rename to bins/inbreeding/src/.nushell/path.nu diff --git a/bins/inbreeding/plot.nu b/bins/inbreeding/src/.nushell/plot.nu similarity index 97% rename from bins/inbreeding/plot.nu rename to bins/inbreeding/src/.nushell/plot.nu index 6b267131..4405a12b 100644 --- a/bins/inbreeding/plot.nu +++ b/bins/inbreeding/src/.nushell/plot.nu @@ -1,9 +1,9 @@ use std repeat use consts.nu -use ../../.nushell plot gplt -use ../../.nushell color * -use ../../.nushell error "error throw" +use $consts.NUSHELL plot gplt +use $consts.NUSHELL color * +use $consts.NUSHELL error "error throw" def "parse strategy" []: string -> record<type: string> { let s = $in diff --git a/bins/inbreeding/run.nu b/bins/inbreeding/src/.nushell/run.nu similarity index 98% rename from bins/inbreeding/run.nu rename to bins/inbreeding/src/.nushell/run.nu index 59610af7..bd0d37c0 100644 --- a/bins/inbreeding/run.nu +++ b/bins/inbreeding/src/.nushell/run.nu @@ -1,5 +1,5 @@ use consts.nu -use ../../.nushell error "error throw" +use $consts.NUSHELL error "error throw" const VALID_HEX_CHARS = "abcdefABCDEF0123456789" diff --git a/bins/inbreeding/watch.nu b/bins/inbreeding/src/.nushell/watch.nu similarity index 100% rename from bins/inbreeding/watch.nu rename to bins/inbreeding/src/.nushell/watch.nu -- GitLab