nushell/crates/nu-parser/Cargo.toml

33 lines
923 B
TOML
Raw Normal View History

[package]
authors = ["The Nu Project Contributors"]
2020-04-21 20:34:32 +02:00
description = "Nushell parser"
2020-07-05 22:12:44 +02:00
edition = "2018"
2020-04-21 20:34:32 +02:00
license = "MIT"
2020-07-05 22:12:44 +02:00
name = "nu-parser"
2021-08-24 20:01:17 +02:00
version = "0.36.0"
[dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
codespan-reporting = "0.11.0"
2020-07-05 22:12:44 +02:00
derive-new = "0.5.8"
2021-01-11 19:50:53 +01:00
derive_is_enum_variant = "0.1.1"
2021-06-22 07:22:33 +02:00
indexmap = { version="1.6.1", features=["serde-1"] }
2021-02-05 21:54:54 +01:00
log = "0.4"
2021-06-22 07:22:33 +02:00
num-bigint = { version="0.3.1", features=["serde"] }
num-traits = "0.2.14"
2021-02-05 21:54:54 +01:00
serde = "1.0"
itertools = "0.10.0"
smart-default = "0.6.0"
2019-12-02 22:14:51 +01:00
dunce = "1.0.1"
Allow custom lib dir path for sourcing nu script libraries. (#3940) Given we can write nu scripts. As the codebase grows, splitting into many smaller nu scripts is necessary. In general, when we work with paths and files we seem to face quite a few difficulties. Here we just tackle one of them and it involves sourcing files that also source other nu files and so forth. The current working directory becomes important here and being on a different directory when sourcing scripts will not work. Mostly because we expand the path on the current working directory and parse the files when a source command call is done. For the moment, we introduce a `lib_dirs` configuration value and, unfortunately, introduce a new dependency in `nu-parser` (`nu-data`) to get a handle of the configuration file to retrieve it. This should give clues and ideas as the new parser engine continues (introduce a way to also know paths) With this PR we can do the following: Let's assume we want to write a nu library called `my_library`. We will have the code in a directory called `project`: The file structure will looks like this: ``` project/my_library.nu project/my_library/hello.nu project/my_library/name.nu ``` This "pattern" works well, that is, when creating a library have a directory named `my_library` and next to it a `my_library.nu` file. Filling them like this: ``` source my_library/hello.nu source my_library/name.nu ``` ``` def hello [] { "hello world" } ``` ``` def name [] { "Nu" end ``` Assuming this `project` directory is stored at `/path/to/lib/project`, we can do: ``` config set lib_dirs ['path/to/lib/project'] ``` Given we have this `lib_dirs` configuration value, we can be anywhere while using Nu and do the following: ``` source my_library.nu echo (hello) (name) ```
2021-08-26 09:04:04 +02:00
2021-08-24 20:01:17 +02:00
nu-errors = { version = "0.36.0", path="../nu-errors" }
Allow custom lib dir path for sourcing nu script libraries. (#3940) Given we can write nu scripts. As the codebase grows, splitting into many smaller nu scripts is necessary. In general, when we work with paths and files we seem to face quite a few difficulties. Here we just tackle one of them and it involves sourcing files that also source other nu files and so forth. The current working directory becomes important here and being on a different directory when sourcing scripts will not work. Mostly because we expand the path on the current working directory and parse the files when a source command call is done. For the moment, we introduce a `lib_dirs` configuration value and, unfortunately, introduce a new dependency in `nu-parser` (`nu-data`) to get a handle of the configuration file to retrieve it. This should give clues and ideas as the new parser engine continues (introduce a way to also know paths) With this PR we can do the following: Let's assume we want to write a nu library called `my_library`. We will have the code in a directory called `project`: The file structure will looks like this: ``` project/my_library.nu project/my_library/hello.nu project/my_library/name.nu ``` This "pattern" works well, that is, when creating a library have a directory named `my_library` and next to it a `my_library.nu` file. Filling them like this: ``` source my_library/hello.nu source my_library/name.nu ``` ``` def hello [] { "hello world" } ``` ``` def name [] { "Nu" end ``` Assuming this `project` directory is stored at `/path/to/lib/project`, we can do: ``` config set lib_dirs ['path/to/lib/project'] ``` Given we have this `lib_dirs` configuration value, we can be anywhere while using Nu and do the following: ``` source my_library.nu echo (hello) (name) ```
2021-08-26 09:04:04 +02:00
nu-data = { version = "0.36.0", path="../nu-data" }
2021-08-24 20:01:17 +02:00
nu-path = { version = "0.36.0", path="../nu-path" }
nu-protocol = { version = "0.36.0", path="../nu-protocol" }
nu-source = { version = "0.36.0", path="../nu-source" }
nu-test-support = { version = "0.36.0", path="../nu-test-support" }
[features]
stable = []