Skip to content
Snippets Groups Projects
Commit 45540a7c authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

make `.nushell/` a proper module (!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...
parent f270ac3e
No related branches found
No related tags found
1 merge request!123make `.nushell/` a proper module
Pipeline #5292 passed
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
use venv.nu VENV
export const COMMON_OPTIONS = [ export const COMMON_OPTIONS = [
--x-scale log --x-scale log
--x-scale-base 2 --x-scale-base 2
...@@ -70,6 +68,5 @@ export def into-axis-options [-x: string, -y: string]: table<x: float, y: float> ...@@ -70,6 +68,5 @@ export def into-axis-options [-x: string, -y: string]: table<x: float, y: float>
} }
export def --wrapped gplt [...args: string] { export def --wrapped gplt [...args: string] {
overlay use $VENV
^gplt ...$args ^gplt ...$args
} }
export const VENV = ($nu.home-path | path join ".local/share/venvs/gplt/bin/activate.nu")
...@@ -25,7 +25,7 @@ Komodo provides a bunch of other binaries that might be interesting of useful to ...@@ -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 The easiest is to use the `cargo.nu` Nushell module as follows
```bash ```bash
use .nushell/cargo.nu "cargo bin" use .nushell cargo "cargo bin"
help cargo bin help cargo bin
``` ```
......
use ../../../.nushell/math.nu * use ../../../.nushell math *
use ../../../.nushell/fs.nu check-file use ../../../.nushell fs check-file
use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS, gplt ] use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ]
export def main [data: path, --save: path] { export def main [data: path, --save: path] {
check-file $data --span (metadata $data).span check-file $data --span (metadata $data).span
......
use ../../../.nushell/math.nu * use ../../../.nushell math *
use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS ] use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS ]
use ../../../.nushell/fs.nu check-file use ../../../.nushell fs check-file
use ../../../.nushell/plot.nu gplt use ../../../.nushell plot gplt
export def encoding [data: path, --save: path] { export def encoding [data: path, --save: path] {
check-file $data --span (metadata $data).span check-file $data --span (metadata $data).span
......
use ../../../.nushell/formats.nu * use ../../../.nushell formats *
export def main [ export def main [
--output: path = "./fec.ndjson", --output: path = "./fec.ndjson",
......
use ../../../.nushell/math.nu * use ../../../.nushell math *
use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS ] use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS ]
use ../../../.nushell/fs.nu check-file use ../../../.nushell fs check-file
use ../../../.nushell/plot.nu gplt use ../../../.nushell plot gplt
export def main [data: path, --save: path] { export def main [data: path, --save: path] {
check-file $data --span (metadata $data).span check-file $data --span (metadata $data).span
......
use ../../../.nushell/formats.nu * use ../../../.nushell formats *
export def main [ export def main [
--output: path = "./recoding.ndjson", --output: path = "./recoding.ndjson",
......
use ../../../.nushell/math.nu * use ../../../.nushell math *
use ../../../.nushell/fs.nu check-file use ../../../.nushell fs check-file
use ../../../.nushell/plot.nu [ into-axis-options, COMMON_OPTIONS, gplt ] use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ]
export def main [data: path, --save: path] { export def main [data: path, --save: path] {
check-file $data --span (metadata $data).span check-file $data --span (metadata $data).span
......
use std repeat use std repeat
use consts.nu use consts.nu
use ../../.nushell/plot.nu gplt use ../../.nushell plot gplt
use ../../.nushell/color.nu * use ../../.nushell color *
use ../../.nushell/error.nu "error throw" use ../../.nushell error "error throw"
def "parse strategy" []: string -> record<type: string> { def "parse strategy" []: string -> record<type: string> {
let s = $in let s = $in
......
use consts.nu use consts.nu
use ../../.nushell/cargo.nu "cargo bin" use ../../.nushell cargo "cargo bin"
export def main [ export def main [
--options: record< --options: record<
......
...@@ -7,7 +7,7 @@ use ../komodo.nu [ ...@@ -7,7 +7,7 @@ use ../komodo.nu [
"komodo reconstruct", "komodo reconstruct",
"komodo ls", "komodo ls",
] ]
use ../.nushell/binary.nu [ "bytes from_int" ] use ../.nushell binary [ "bytes from_int" ]
use std assert use std assert
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# please run `komodo --help` or `komodo <tab>` to have a look at more information # 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 KOMODO_BINARY = "./target/release/komodo"
const DEFAULT_LOG_LEVEL = "INFO" const DEFAULT_LOG_LEVEL = "INFO"
......
use ../.nushell/binary.nu [ use ../.nushell binary [
"bytes decode", "bytes encode", "bytes from_int", "bytes to_int" "bytes decode", "bytes encode", "bytes from_int", "bytes to_int"
] ]
......
...@@ -7,7 +7,7 @@ use ../komodo.nu [ ...@@ -7,7 +7,7 @@ use ../komodo.nu [
"komodo ls", "komodo ls",
"komodo clean", "komodo clean",
] ]
use ../.nushell/binary.nu [ "bytes from_int" ] use ../.nushell binary [ "bytes from_int" ]
use std assert use std assert
......
use ../.nushell/color.nu [ use ../.nushell color [
"color from-floats", "color from-floats",
"color from-ints", "color from-ints",
"color from-string", "color from-string",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment