nushell/Cargo.toml

185 lines
4.3 KiB
TOML
Raw Normal View History

2019-05-10 18:59:12 +02:00
[package]
2019-05-17 01:39:58 +02:00
name = "nu"
2019-10-15 07:41:05 +02:00
version = "0.4.0"
2019-08-23 07:36:52 +02:00
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
2019-05-16 23:46:24 +02:00
description = "A shell for the GitHub era"
2019-06-02 18:50:41 +02:00
license = "MIT"
2019-05-10 18:59:12 +02:00
edition = "2018"
2019-07-16 21:17:46 +02:00
readme = "README.md"
2019-06-27 06:56:48 +02:00
default-run = "nu"
2019-07-16 21:17:46 +02:00
repository = "https://github.com/nushell/nushell"
homepage = "https://www.nushell.sh"
2019-08-23 07:28:30 +02:00
documentation = "https://book.nushell.sh"
2019-05-10 18:59:12 +02:00
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
2019-09-15 20:18:06 +02:00
rustyline = "5.0.3"
2019-09-13 05:44:21 +02:00
chrono = { version = "0.4.9", features = ["serde"] }
2019-08-31 23:19:59 +02:00
derive-new = "0.5.8"
2019-05-10 18:59:12 +02:00
prettytable-rs = "0.8.0"
itertools = "0.8.0"
2019-09-13 05:44:21 +02:00
ansi_term = "0.12.1"
2019-06-26 20:08:41 +02:00
nom = "5.0.0"
2019-05-11 09:00:33 +02:00
dunce = "1.0.0"
2019-09-13 05:44:21 +02:00
indexmap = { version = "1.2.0", features = ["serde-1"] }
chrono-humanize = "0.0.11"
2019-07-29 09:46:24 +02:00
byte-unit = "3.0.1"
2019-08-30 20:27:15 +02:00
base64 = "0.10.1"
futures-preview = { version = "=0.3.0-alpha.18", features = ["compat", "io-compat"] }
async-stream = "0.1.1"
2019-08-02 21:15:07 +02:00
futures_codec = "0.2.5"
num-traits = "0.2.8"
term = "0.5.2"
2019-05-25 21:07:52 +02:00
bytes = "0.4.12"
2019-08-07 19:49:11 +02:00
log = "0.4.8"
2019-08-23 05:29:08 +02:00
pretty_env_logger = "0.3.1"
2019-09-13 05:44:21 +02:00
serde = { version = "1.0.100", features = ["derive"] }
2019-08-31 16:22:45 +02:00
bson = { version = "0.14.0", features = ["decimal128"] }
2019-07-04 05:06:43 +02:00
serde_json = "1.0.40"
2019-08-23 05:29:08 +02:00
serde-hjson = "0.9.1"
2019-06-03 09:41:28 +02:00
serde_yaml = "0.8"
2019-08-10 07:02:15 +02:00
serde_bytes = "0.11.2"
getset = "0.0.8"
2019-10-15 21:54:46 +02:00
language-reporting = "0.4.0"
app_dirs = "1.2.1"
csv = "1.1"
2019-08-23 05:29:08 +02:00
toml = "0.5.3"
clap = "2.33.0"
2019-09-13 05:44:21 +02:00
git2 = { version = "0.10.1", default_features = false }
2019-07-29 09:46:24 +02:00
dirs = "2.0.2"
glob = "0.3.0"
2019-06-07 02:31:22 +02:00
ctrlc = "3.1.3"
surf = "1.0.2"
2019-08-24 21:36:19 +02:00
url = "2.1.0"
2019-08-10 07:02:15 +02:00
roxmltree = "0.7.0"
nom_locate = "1.0.0"
Overhaul the expansion system The main thrust of this (very large) commit is an overhaul of the expansion system. The parsing pipeline is: - Lightly parse the source file for atoms, basic delimiters and pipeline structure into a token tree - Expand the token tree into a HIR (high-level intermediate representation) based upon the baseline syntax rules for expressions and the syntactic shape of commands. Somewhat non-traditionally, nu doesn't have an AST at all. It goes directly from the token tree, which doesn't represent many important distinctions (like the difference between `hello` and `5KB`) directly into a high-level representation that doesn't have a direct correspondence to the source code. At a high level, nu commands work like macros, in the sense that the syntactic shape of the invocation of a command depends on the definition of a command. However, commands do not have the ability to perform unrestricted expansions of the token tree. Instead, they describe their arguments in terms of syntactic shapes, and the expander expands the token tree into HIR based upon that definition. For example, the `where` command says that it takes a block as its first required argument, and the description of the block syntactic shape expands the syntax `cpu > 10` into HIR that represents `{ $it.cpu > 10 }`. This commit overhauls that system so that the syntactic shapes are described in terms of a few new traits (`ExpandSyntax` and `ExpandExpression` are the primary ones) that are more composable than the previous system. The first big win of this new system is the addition of the `ColumnPath` shape, which looks like `cpu."max ghz"` or `package.version`. Previously, while a variable path could look like `$it.cpu."max ghz"`, the tail of a variable path could not be easily reused in other contexts. Now, that tail is its own syntactic shape, and it can be used as part of a command's signature. This cleans up commands like `inc`, `add` and `edit` as well as shorthand blocks, which can now look like `| where cpu."max ghz" > 10`
2019-09-18 00:26:27 +02:00
nom-tracable = "0.4.0"
2019-07-29 09:46:24 +02:00
unicode-xid = "0.2.0"
2019-06-16 08:43:40 +02:00
serde_ini = "0.2.0"
2019-06-18 04:04:34 +02:00
subprocess = "0.1.18"
2019-09-13 05:44:21 +02:00
mime = "0.3.14"
2019-07-04 07:23:05 +02:00
pretty-hex = "0.1.0"
2019-08-27 23:45:18 +02:00
hex = "0.3.2"
tempfile = "3.1.0"
semver = "0.9.0"
2019-08-10 08:31:31 +02:00
which = "2.0.1"
2019-08-16 07:47:47 +02:00
textwrap = {version = "0.11.0", features = ["term_size"]}
Add support for ~ expansion This ended up being a bit of a yak shave. The basic idea in this commit is to expand `~` in paths, but only in paths. The way this is accomplished is by doing the expansion inside of the code that parses literal syntax for `SyntaxType::Path`. As a quick refresher: every command is entitled to expand its arguments in a custom way. While this could in theory be used for general-purpose macros, today the expansion facility is limited to syntactic hints. For example, the syntax `where cpu > 0` expands under the hood to `where { $it.cpu > 0 }`. This happens because the first argument to `where` is defined as a `SyntaxType::Block`, and the parser coerces binary expressions whose left-hand-side looks like a member into a block when the command is expecting one. This is mildly more magical than what most programming languages would do, but we believe that it makes sense to allow commands to fine-tune the syntax because of the domain nushell is in (command-line shells). The syntactic expansions supported by this facility are relatively limited. For example, we don't allow `$it` to become a bare word, simply because the command asks for a string in the relevant position. That would quickly become more confusing than it's worth. This PR adds a new `SyntaxType` rule: `SyntaxType::Path`. When a command declares a parameter as a `SyntaxType::Path`, string literals and bare words passed as an argument to that parameter are processed using the path expansion rules. Right now, that only means that `~` is expanded into the home directory, but additional rules are possible in the future. By restricting this expansion to a syntactic expansion when passed as an argument to a command expecting a path, we avoid making `~` a generally reserved character. This will also allow us to give good tab completion for paths with `~` characters in them when a command is expecting a path. In order to accomplish the above, this commit changes the parsing functions to take a `Context` instead of just a `CommandRegistry`. From the perspective of macro expansion, you can think of the `CommandRegistry` as a dictionary of in-scope macros, and the `Context` as the compile-time state used in expansion. This could gain additional functionality over time as we find more uses for the expansion system.
2019-08-26 21:21:03 +02:00
shellexpand = "1.0.0"
2019-09-13 05:44:21 +02:00
futures-timer = "0.4.0"
2019-08-30 21:07:07 +02:00
pin-utils = "0.1.0-alpha.4"
2019-09-13 05:44:21 +02:00
num-bigint = { version = "0.2.3", features = ["serde"] }
bigdecimal = { version = "0.1.0", features = ["serde"] }
2019-09-13 05:44:21 +02:00
natural = "0.3.0"
2019-09-19 06:25:29 +02:00
serde_urlencoded = "0.6.1"
2019-09-16 22:48:22 +02:00
sublime_fuzzy = "0.5"
trash = "1.0.0"
2019-05-23 06:30:43 +02:00
2019-10-13 06:53:58 +02:00
regex = {version = "1", optional = true }
neso = { version = "0.5.0", optional = true }
crossterm = { version = "0.10.2", optional = true }
syntect = {version = "3.2.0", optional = true }
onig_sys = {version = "=69.1.0", optional = true }
heim = {version = "0.0.8", optional = true }
battery = {version = "0.7.4", optional = true }
rawkey = {version = "0.1.2", optional = true }
clipboard = {version = "0.5", optional = true }
ptree = {version = "0.2" }
2019-09-13 05:44:21 +02:00
image = { version = "0.22.2", default_features = false, features = ["png_codec", "jpeg"], optional = true }
2019-08-29 01:32:58 +02:00
[features]
default = ["textview", "sys", "ps"]
2019-08-29 01:32:58 +02:00
raw-key = ["rawkey", "neso"]
textview = ["syntect", "onig_sys", "crossterm"]
binaryview = ["image", "crossterm"]
sys = ["heim", "battery"]
ps = ["heim"]
Overhaul the coloring system This commit replaces the previous naive coloring system with a coloring system that is more aligned with the parser. The main benefit of this change is that it allows us to use parsing rules to decide how to color tokens. For example, consider the following syntax: ``` $ ps | where cpu > 10 ``` Ideally, we could color `cpu` like a column name and not a string, because `cpu > 10` is a shorthand block syntax that expands to `{ $it.cpu > 10 }`. The way that we know that it's a shorthand block is that the `where` command declares that its first parameter is a `SyntaxShape::Block`, which allows the shorthand block form. In order to accomplish this, we need to color the tokens in a way that corresponds to their expanded semantics, which means that high-fidelity coloring requires expansion. This commit adds a `ColorSyntax` trait that corresponds to the `ExpandExpression` trait. The semantics are fairly similar, with a few differences. First `ExpandExpression` consumes N tokens and returns a single `hir::Expression`. `ColorSyntax` consumes N tokens and writes M `FlatShape` tokens to the output. Concretely, for syntax like `[1 2 3]` - `ExpandExpression` takes a single token node and produces a single `hir::Expression` - `ColorSyntax` takes the same token node and emits 7 `FlatShape`s (open delimiter, int, whitespace, int, whitespace, int, close delimiter) Second, `ColorSyntax` is more willing to plow through failures than `ExpandExpression`. In particular, consider syntax like ``` $ ps | where cpu > ``` In this case - `ExpandExpression` will see that the `where` command is expecting a block, see that it's not a literal block and try to parse it as a shorthand block. It will successfully find a member followed by an infix operator, but not a following expression. That means that the entire pipeline part fails to parse and is a syntax error. - `ColorSyntax` will also try to parse it as a shorthand block and ultimately fail, but it will fall back to "backoff coloring mode", which parsing any unidentified tokens in an unfallible, simple way. In this case, `cpu` will color as a string and `>` will color as an operator. Finally, it's very important that coloring a pipeline infallibly colors the entire string, doesn't fail, and doesn't get stuck in an infinite loop. In order to accomplish this, this PR separates `ColorSyntax`, which is infallible from `FallibleColorSyntax`, which might fail. This allows the type system to let us know if our coloring rules bottom out at at an infallible rule. It's not perfect: it's still possible for the coloring process to get stuck or consume tokens non-atomically. I intend to reduce the opportunity for those problems in a future commit. In the meantime, the current system catches a number of mistakes (like trying to use a fallible coloring rule in a loop without thinking about the possibility that it will never terminate).
2019-10-06 22:22:50 +02:00
# trace = ["nom-tracable/trace"]
all = ["raw-key", "textview", "binaryview", "sys", "ps", "clipboard"]
2019-08-29 01:32:58 +02:00
2019-08-27 23:45:18 +02:00
[dependencies.rusqlite]
version = "0.20.0"
features = ["bundled", "blob"]
2019-05-29 17:26:45 +02:00
[dev-dependencies]
pretty_assertions = "0.6.1"
2019-06-27 06:56:48 +02:00
[build-dependencies]
toml = "0.5.3"
serde = { version = "1.0.101", features = ["derive"] }
2019-06-27 06:56:48 +02:00
[lib]
name = "nu"
path = "src/lib.rs"
[[bin]]
name = "nu_plugin_inc"
path = "src/plugins/inc.rs"
2019-07-26 20:40:00 +02:00
[[bin]]
name = "nu_plugin_sum"
path = "src/plugins/sum.rs"
2019-10-09 04:17:02 +02:00
[[bin]]
name = "nu_plugin_average"
path = "src/plugins/average.rs"
2019-09-02 07:37:13 +02:00
[[bin]]
name = "nu_plugin_embed"
path = "src/plugins/embed.rs"
2019-07-22 05:52:57 +02:00
[[bin]]
name = "nu_plugin_add"
path = "src/plugins/add.rs"
[[bin]]
name = "nu_plugin_edit"
path = "src/plugins/edit.rs"
2019-07-28 09:01:32 +02:00
[[bin]]
name = "nu_plugin_str"
path = "src/plugins/str.rs"
2019-07-03 19:37:09 +02:00
[[bin]]
name = "nu_plugin_skip"
path = "src/plugins/skip.rs"
2019-07-03 19:37:09 +02:00
2019-10-02 20:56:28 +02:00
[[bin]]
name = "nu_plugin_match"
path = "src/plugins/match.rs"
2019-10-13 06:53:58 +02:00
required-features = ["regex"]
2019-10-02 20:56:28 +02:00
[[bin]]
name = "nu_plugin_sys"
path = "src/plugins/sys.rs"
required-features = ["sys"]
[[bin]]
name = "nu_plugin_ps"
path = "src/plugins/ps.rs"
required-features = ["ps"]
2019-07-04 07:11:56 +02:00
[[bin]]
name = "nu_plugin_tree"
path = "src/plugins/tree.rs"
required-features = ["tree"]
2019-07-04 07:11:56 +02:00
2019-07-04 07:23:05 +02:00
[[bin]]
name = "nu_plugin_binaryview"
path = "src/plugins/binaryview.rs"
required-features = ["binaryview"]
2019-07-04 07:23:05 +02:00
2019-07-24 19:14:30 +02:00
[[bin]]
name = "nu_plugin_textview"
path = "src/plugins/textview.rs"
required-features = ["textview"]
2019-07-24 19:14:30 +02:00
[[bin]]
name = "nu_plugin_docker"
path = "src/plugins/docker.rs"
required-features = ["docker"]
2019-06-27 06:56:48 +02:00
[[bin]]
name = "nu"
path = "src/main.rs"