Compare commits

..

28 Commits

Author SHA1 Message Date
JT
62011b6bcc Bump to 0.42 (#4234) 2021-12-28 20:56:59 +11:00
1214cd57e8 bat: use regex-onig instead of regex-fancy (#4226)
Fixes #4224

Signed-off-by: nibon7 <nibon7@163.com>
2021-12-24 08:34:59 -06:00
6cd124ddb2 allow insecure server connections when using SSL (#4219)
Fixes #4211

Signed-off-by: nibon7 <nibon7@163.com>
2021-12-23 06:48:43 +11:00
d32aec5906 Don't panic if the other end of std{out,err} is closed (#4179)
* fix #4161

println! and friends will panic on BrokenPipe. The solution is to use
writeln! instead, and ignore the error (or do we want to do something else?)

* test that nu doesn't panic in case of BrokenPipe error

* fixup! test that nu doesn't panic in case of BrokenPipe error

* make do_not_panic_if_broken_pipe only run on UNIX systems
2021-12-21 10:08:41 +11:00
e919f9a73b use heck for string casing (#4081)
I removed the Inflector dependency in favor of heck for two reasons:
- to close #3674.
- heck seems simpler and actively maintained

We could probably alter the structure of the `str_` module to expose the
individual casing behaviors better.
I did not feel as confident on changing those signatures.

So I took a lazier approach of a macro in the `mod.rs` that creates the public
shimming function to heck's traits.
2021-12-14 09:43:48 -06:00
a3c349746f ci: update macOS agent (#4207)
10.14 has been deprecated: https://github.com/Azure/azure-sdk-for-cpp/issues/3168

This hopefully fixes recent CI failures!
2021-12-14 08:55:51 -06:00
b5f8f64d79 ci: fix macOS agent (#4203)
I noticed the agent documentation uses uppercase: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml
2021-12-13 13:08:03 -06:00
1576b959f9 update feat template (#4201) 2021-12-12 16:15:31 -06:00
4096f52003 update templates2 (#4200) 2021-12-12 16:11:27 -06:00
7ceb668419 Revert "try out title change (#4198)" (#4199)
This reverts commit 420aee18ca.
2021-12-12 16:06:07 -06:00
420aee18ca try out title change (#4198) 2021-12-12 16:05:24 -06:00
pin
15e9c11849 Fix build on NetBSD (#4192) 2021-12-09 14:23:40 +02:00
9fd680ae2b fix: Implicit coercion of boolean false and empty value #4094 (#4120)
Signed-off-by: closetool <c299999999@qq.com>
2021-12-09 14:19:51 +02:00
ad94ed5e13 Fix Configuration section in bug report template (#4181)
* Fix Configuration section in bug report template

Change the placeholder content to actually match the `to md` output, and add `--pretty`

* Don't omit data in placeholder configuration table

* Remove blank line in bug_report.yml
2021-12-08 13:32:28 -06:00
1bdcdcca70 fix: change into column_path to into column-path (breaking change) (#4185) (#4189) 2021-12-08 11:04:55 +02:00
JT
610e3911f6 Bump to 0.41 (#4187) 2021-12-08 06:21:00 +13:00
ee9eddd851 avoid unnecessary allocation (#4178) 2021-12-06 07:38:58 +13:00
JT
c08e145501 Fix clippy warnings (#4176) 2021-12-03 07:05:38 +13:00
c00853a473 Seems like accessing $it outside each is not possible now (#4000) 2021-12-03 06:49:24 +13:00
79c7b20cfd add login shell flag (#4175) 2021-12-02 20:05:04 +13:00
JT
89cbfd758d Remove 'arboard' (#4174) 2021-12-02 08:48:03 +13:00
e6e6b730f3 Bye bye upx sorry (#4173)
* bye bye upx, let's try stripping alone

* remove all stripping - not sure it's even working
2021-11-30 13:34:16 -06:00
0fe6a7c1b5 bye bye upx, let's try stripping alone (#4172) 2021-11-30 12:11:01 -06:00
1794ad51bd Sanitize arguments to external commands a bit better (#4157)
* fix #4140

We are passing commands into a shell underneath but we were not
escaping arguments correctly. This new version of the code also takes
into consideration the ";" and "&" characters, which have special
meaning in shells.

We would probably benefit from a more robust way to join arguments to
shell programs. Python's stdlib has shlex.join, and perhaps we can
take that implementation as a reference.

* clean up escaping of posix shell args

I believe the right place to do escaping of arguments was in the
spawn_sh_command function. Note that this change prevents things like:

^echo "$(ls)"

from executing the ls command. Instead, this will just print

$(ls)

The regex has been taken from the python stdlib implementation of shlex.quote

* fix non-literal parameters and single quotes

* address clippy's comments

* fixup! address clippy's comments

* test that subshell commands are sanitized properly
2021-11-29 09:46:42 -06:00
fb197f562a save --append: create file if it doesn't exist (#4156)
* have save --append create file if not exists

Currently, doing:

echo a | save --raw --append file.txt

will fail if file.txt does not exist. This PR changes that

* test that `save --append` will create new file
2021-11-26 12:27:41 -06:00
91c270c14a fix markup (#4155) 2021-11-26 07:37:50 -06:00
3e93ae8af4 Correct spelling (#4152) 2021-11-25 11:11:20 -06:00
e06df124ca upgrading dependencies (#4135)
* upgrade dependencies
num-bigint 0.3.1 -> 0.4.3
bigdecimal-rs 0.2.1 -> bigdecimal 0.3.0
s3hander 0.7 -> 0.7.5
bat 0.18 -> 0.18, default-features = false

* upgrade arboard 1.1.0 -> 2.0.1

* in polars use comfy-table instead of prettytable-rs
the last release of prettytable-rs was `0.8.0 Sep 27, 2018`
and it uses `term 0.5` as a dependency

* upgrade dependencies

* upgrade trash -> 2.0.1

Co-authored-by: ahkrr <alexhk@protonmail.com>
2021-11-20 07:11:11 -06:00
93 changed files with 1154 additions and 1554 deletions

View File

@ -16,7 +16,7 @@ strategy:
image: ubuntu-18.04 image: ubuntu-18.04
style: 'wasm' style: 'wasm'
macos-stable: macos-stable:
image: macos-10.14 image: macOS-10.15
style: 'unflagged' style: 'unflagged'
windows-stable: windows-stable:
image: windows-2019 image: windows-2019

View File

@ -5,7 +5,7 @@ body:
id: description id: description
attributes: attributes:
label: Describe the bug label: Describe the bug
description: A clear and concise description of what the bug is. description: Thank you for your bug report. We are working diligently with our community to integrate our latest code base that we call [engine-q](https://github.com/nushell/engine-q). We would like your help with this by checking to see if this bug report is still needed in engine-q. Thank you for your patience while we ready the next version of nushell.
validations: validations:
required: true required: true
- type: textarea - type: textarea
@ -38,22 +38,20 @@ body:
id: config id: config
attributes: attributes:
label: Configuration label: Configuration
description: "Please run `> version | pivot key value | to md` and paste the output to show OS, features, etc" description: "Please run `version | pivot key value | to md --pretty` and paste the output to show OS, features, etc."
placeholder: | placeholder: |
> version | pivot key value | to md > version | pivot key value | to md --pretty
╭───┬────────────────────┬───────────────────────────────────────────────────────────────────────╮ | key | value |
│ # │ key │ value │ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
├───┼────────────────────┼───────────────────────────────────────────────────────────────────────┤ | version | 0.40.0 |
│ 0 │ version │ 0.24.1 | build_os | linux-x86_64 |
│ 1 │ build_os │ macos-x86_64 │ | rust_version | rustc 1.56.1 |
│ 2 │ rust_version │ rustc 1.48.0 | cargo_version | cargo 1.56.0 |
│ 3 │ cargo_version │ cargo 1.48.0 | pkg_version | 0.40.0 |
│ 4 │ pkg_version │ 0.24.1 | build_time | 1980-01-01 00:00:00 +00:00 |
│ 5 │ build_time │ 2020-12-18 09:54:09 │ | build_rust_channel | release |
│ 6 │ build_rust_channel │ release | features | clipboard-cli, ctrlc, dataframe, default, rustyline, term, trash, uuid, which, zip |
│ 7 │ features │ ctrlc, default, directories, dirs, git, ichwh, rich-benchmark, | installed_plugins | binaryview, chart bar, chart line, fetch, from bson, from sqlite, inc, match, post, ps, query json, s3, selector, start, sys, textview, to bson, to sqlite, tree, xpath |
│ │ │ rustyline, term, uuid, which, zip │
╰───┴────────────────────┴───────────────────────────────────────────────────────────────────────╯
validations: validations:
required: false required: false
- type: textarea - type: textarea

View File

@ -5,7 +5,7 @@ body:
id: problem id: problem
attributes: attributes:
label: Related problem label: Related problem
description: Is your feature request related to a problem? Please describe. description: Thank you for your feature request. We are working diligently with our community to integrate our latest code base that we call [engine-q](https://github.com/nushell/engine-q). We would like your help with this by checking to see if this feature request is still needed in engine-q. Thank you for your patience while we ready the next version of nushell.
placeholder: | placeholder: |
A clear and concise description of what the problem is. A clear and concise description of what the problem is.
Example: I am trying to do [...] but [...] Example: I am trying to do [...] but [...]

View File

@ -3,7 +3,7 @@ name: Create Release Draft
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
tags: ['[0-9]+.[0-9]+.[0-9]+*'] tags: ["[0-9]+.[0-9]+.[0-9]+*"]
jobs: jobs:
linux: linux:
@ -29,95 +29,59 @@ jobs:
command: build command: build
args: --release --all --features=extra args: --release --all --features=extra
- name: Compress binaries (nu) # - name: Strip binaries (nu)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu
with:
file: target/release/nu
- name: Compress binaries (nu_plugin_inc) # - name: Strip binaries (nu_plugin_inc)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_inc
with:
file: target/release/nu_plugin_inc
- name: Compress binaries (nu_plugin_match) # - name: Strip binaries (nu_plugin_match)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_match
with:
file: target/release/nu_plugin_match
- name: Compress binaries (nu_plugin_textview) # - name: Strip binaries (nu_plugin_textview)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_textview
with:
file: target/release/nu_plugin_textview
- name: Compress binaries (nu_plugin_binaryview) # - name: Strip binaries (nu_plugin_binaryview)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_binaryview
with:
file: target/release/nu_plugin_binaryview
- name: Compress binaries (nu_plugin_chart_bar) # - name: Strip binaries (nu_plugin_chart_bar)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_bar
with:
file: target/release/nu_plugin_chart_bar
- name: Compress binaries (nu_plugin_chart_line) # - name: Strip binaries (nu_plugin_chart_line)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_line
with:
file: target/release/nu_plugin_chart_line
- name: Compress binaries (nu_plugin_from_bson) # - name: Strip binaries (nu_plugin_from_bson)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_bson
with:
file: target/release/nu_plugin_from_bson
- name: Compress binaries (nu_plugin_from_sqlite) # - name: Strip binaries (nu_plugin_from_sqlite)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_sqlite
with:
file: target/release/nu_plugin_from_sqlite
- name: Compress binaries (nu_plugin_from_mp4) # - name: Strip binaries (nu_plugin_from_mp4)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_mp4
with:
file: target/release/nu_plugin_from_mp4
- name: Compress binaries (nu_plugin_query_json) # - name: Strip binaries (nu_plugin_query_json)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_query_json
with:
file: target/release/nu_plugin_query_json
- name: Compress binaries (nu_plugin_s3) # - name: Strip binaries (nu_plugin_s3)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_s3
with:
file: target/release/nu_plugin_s3
- name: Compress binaries (nu_plugin_selector) # - name: Strip binaries (nu_plugin_selector)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_selector
with:
file: target/release/nu_plugin_selector
- name: Compress binaries (nu_plugin_start) # - name: Strip binaries (nu_plugin_start)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_start
with:
file: target/release/nu_plugin_start
- name: Compress binaries (nu_plugin_to_bson) # - name: Strip binaries (nu_plugin_to_bson)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_bson
with:
file: target/release/nu_plugin_to_bson
- name: Compress binaries (nu_plugin_to_sqlite) # - name: Strip binaries (nu_plugin_to_sqlite)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_sqlite
with:
file: target/release/nu_plugin_to_sqlite
- name: Compress binaries (nu_plugin_tree) # - name: Strip binaries (nu_plugin_tree)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_tree
with:
file: target/release/nu_plugin_tree
- name: Compress binaries (nu_plugin_xpath) # - name: Strip binaries (nu_plugin_xpath)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_xpath
with:
file: target/release/nu_plugin_xpath
- name: Create output directory - name: Create output directory
run: mkdir output run: mkdir output
@ -161,95 +125,59 @@ jobs:
command: build command: build
args: --release --all --features=extra args: --release --all --features=extra
- name: Compress binaries (nu) # - name: Strip binaries (nu)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu
with:
file: target/release/nu
- name: Compress binaries (nu_plugin_inc) # - name: Strip binaries (nu_plugin_inc)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_inc
with:
file: target/release/nu_plugin_inc
- name: Compress binaries (nu_plugin_match) # - name: Strip binaries (nu_plugin_match)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_match
with:
file: target/release/nu_plugin_match
- name: Compress binaries (nu_plugin_textview) # - name: Strip binaries (nu_plugin_textview)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_textview
with:
file: target/release/nu_plugin_textview
- name: Compress binaries (nu_plugin_binaryview) # - name: Strip binaries (nu_plugin_binaryview)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_binaryview
with:
file: target/release/nu_plugin_binaryview
- name: Compress binaries (nu_plugin_chart_bar) # - name: Strip binaries (nu_plugin_chart_bar)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_bar
with:
file: target/release/nu_plugin_chart_bar
- name: Compress binaries (nu_plugin_chart_line) # - name: Strip binaries (nu_plugin_chart_line)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_line
with:
file: target/release/nu_plugin_chart_line
- name: Compress binaries (nu_plugin_from_bson) # - name: Strip binaries (nu_plugin_from_bson)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_bson
with:
file: target/release/nu_plugin_from_bson
- name: Compress binaries (nu_plugin_from_sqlite) # - name: Strip binaries (nu_plugin_from_sqlite)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_sqlite
with:
file: target/release/nu_plugin_from_sqlite
- name: Compress binaries (nu_plugin_from_mp4) # - name: Strip binaries (nu_plugin_from_mp4)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_mp4
with:
file: target/release/nu_plugin_from_mp4
- name: Compress binaries (nu_plugin_query_json) # - name: Strip binaries (nu_plugin_query_json)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_query_json
with:
file: target/release/nu_plugin_query_json
- name: Compress binaries (nu_plugin_s3) # - name: Strip binaries (nu_plugin_s3)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_s3
with:
file: target/release/nu_plugin_s3
- name: Compress binaries (nu_plugin_selector) # - name: Strip binaries (nu_plugin_selector)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_selector
with:
file: target/release/nu_plugin_selector
- name: Compress binaries (nu_plugin_start) # - name: Strip binaries (nu_plugin_start)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_start
with:
file: target/release/nu_plugin_start
- name: Compress binaries (nu_plugin_to_bson) # - name: Strip binaries (nu_plugin_to_bson)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_bson
with:
file: target/release/nu_plugin_to_bson
- name: Compress binaries (nu_plugin_to_sqlite) # - name: Strip binaries (nu_plugin_to_sqlite)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_sqlite
with:
file: target/release/nu_plugin_to_sqlite
- name: Compress binaries (nu_plugin_tree) # - name: Strip binaries (nu_plugin_tree)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_tree
with:
file: target/release/nu_plugin_tree
- name: Compress binaries (nu_plugin_xpath) # - name: Strip binaries (nu_plugin_xpath)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_xpath
with:
file: target/release/nu_plugin_xpath
- name: Create output directory - name: Create output directory
run: mkdir output run: mkdir output
@ -295,95 +223,59 @@ jobs:
command: build command: build
args: --release --all --features=extra args: --release --all --features=extra
- name: Compress binaries (nu.exe) # - name: Strip binaries (nu.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu.exe
with:
file: target/release/nu.exe
- name: Compress binaries (nu_plugin_inc.exe) # - name: Strip binaries (nu_plugin_inc.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_inc.exe
with:
file: target/release/nu_plugin_inc.exe
- name: Compress binaries (nu_plugin_match.exe) # - name: Strip binaries (nu_plugin_match.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_match.exe
with:
file: target/release/nu_plugin_match.exe
- name: Compress binaries (nu_plugin_textview.exe) # - name: Strip binaries (nu_plugin_textview.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_textview.exe
with:
file: target/release/nu_plugin_textview.exe
- name: Compress binaries (nu_plugin_binaryview.exe) # - name: Strip binaries (nu_plugin_binaryview.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_binaryview.exe
with:
file: target/release/nu_plugin_binaryview.exe
- name: Compress binaries (nu_plugin_chart_bar.exe) # - name: Strip binaries (nu_plugin_chart_bar.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_bar.exe
with:
file: target/release/nu_plugin_chart_bar.exe
- name: Compress binaries (nu_plugin_chart_line.exe) # - name: Strip binaries (nu_plugin_chart_line.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_chart_line.exe
with:
file: target/release/nu_plugin_chart_line.exe
- name: Compress binaries (nu_plugin_from_bson.exe) # - name: Strip binaries (nu_plugin_from_bson.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_bson.exe
with:
file: target/release/nu_plugin_from_bson.exe
- name: Compress binaries (nu_plugin_from_sqlite.exe) # - name: Strip binaries (nu_plugin_from_sqlite.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_sqlite.exe
with:
file: target/release/nu_plugin_from_sqlite.exe
- name: Compress binaries (nu_plugin_from_mp4.exe) # - name: Strip binaries (nu_plugin_from_mp4.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_from_mp4.exe
with:
file: target/release/nu_plugin_from_mp4.exe
- name: Compress binaries (nu_plugin_query_json.exe) # - name: Strip binaries (nu_plugin_query_json.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_query_json.exe
with:
file: target/release/nu_plugin_query_json.exe
- name: Compress binaries (nu_plugin_s3.exe) # - name: Strip binaries (nu_plugin_s3.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_s3.exe
with:
file: target/release/nu_plugin_s3.exe
- name: Compress binaries (nu_plugin_selector.exe) # - name: Strip binaries (nu_plugin_selector.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_selector.exe
with:
file: target/release/nu_plugin_selector.exe
- name: Compress binaries (nu_plugin_start.exe) # - name: Strip binaries (nu_plugin_start.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_start.exe
with:
file: target/release/nu_plugin_start.exe
- name: Compress binaries (nu_plugin_to_bson.exe) # - name: Strip binaries (nu_plugin_to_bson.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_bson.exe
with:
file: target/release/nu_plugin_to_bson.exe
- name: Compress binaries (nu_plugin_to_sqlite.exe) # - name: Strip binaries (nu_plugin_to_sqlite.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_to_sqlite.exe
with:
file: target/release/nu_plugin_to_sqlite.exe
- name: Compress binaries (nu_plugin_tree.exe) # - name: Strip binaries (nu_plugin_tree.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_tree.exe
with:
file: target/release/nu_plugin_tree.exe
- name: Compress binaries (nu_plugin_xpath.exe) # - name: Strip binaries (nu_plugin_xpath.exe)
uses: svenstaro/upx-action@v2 # run: strip target/release/nu_plugin_xpath.exe
with:
file: target/release/nu_plugin_xpath.exe
- name: Create output directory - name: Create output directory
run: mkdir output run: mkdir output

1135
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ license = "MIT"
name = "nu" name = "nu"
readme = "README.md" readme = "README.md"
repository = "https://github.com/nushell/nushell" repository = "https://github.com/nushell/nushell"
version = "0.40.0" version = "0.42.0"
[workspace] [workspace]
members = ["crates/*/"] members = ["crates/*/"]
@ -18,34 +18,34 @@ members = ["crates/*/"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
nu-cli = { version = "0.40.0", path="./crates/nu-cli", default-features=false } nu-cli = { version = "0.42.0", path="./crates/nu-cli", default-features=false }
nu-command = { version = "0.40.0", path="./crates/nu-command" } nu-command = { version = "0.42.0", path="./crates/nu-command" }
nu-completion = { version = "0.40.0", path="./crates/nu-completion" } nu-completion = { version = "0.42.0", path="./crates/nu-completion" }
nu-data = { version = "0.40.0", path="./crates/nu-data" } nu-data = { version = "0.42.0", path="./crates/nu-data" }
nu-engine = { version = "0.40.0", path="./crates/nu-engine" } nu-engine = { version = "0.42.0", path="./crates/nu-engine" }
nu-errors = { version = "0.40.0", path="./crates/nu-errors" } nu-errors = { version = "0.42.0", path="./crates/nu-errors" }
nu-parser = { version = "0.40.0", path="./crates/nu-parser" } nu-parser = { version = "0.42.0", path="./crates/nu-parser" }
nu-path = { version = "0.40.0", path="./crates/nu-path" } nu-path = { version = "0.42.0", path="./crates/nu-path" }
nu-plugin = { version = "0.40.0", path="./crates/nu-plugin" } nu-plugin = { version = "0.42.0", path="./crates/nu-plugin" }
nu-protocol = { version = "0.40.0", path="./crates/nu-protocol" } nu-protocol = { version = "0.42.0", path="./crates/nu-protocol" }
nu-source = { version = "0.40.0", path="./crates/nu-source" } nu-source = { version = "0.42.0", path="./crates/nu-source" }
nu-value-ext = { version = "0.40.0", path="./crates/nu-value-ext" } nu-value-ext = { version = "0.42.0", path="./crates/nu-value-ext" }
nu_plugin_binaryview = { version = "0.40.0", path="./crates/nu_plugin_binaryview", optional=true } nu_plugin_binaryview = { version = "0.42.0", path="./crates/nu_plugin_binaryview", optional=true }
nu_plugin_chart = { version = "0.40.0", path="./crates/nu_plugin_chart", optional=true } nu_plugin_chart = { version = "0.42.0", path="./crates/nu_plugin_chart", optional=true }
nu_plugin_from_bson = { version = "0.40.0", path="./crates/nu_plugin_from_bson", optional=true } nu_plugin_from_bson = { version = "0.42.0", path="./crates/nu_plugin_from_bson", optional=true }
nu_plugin_from_sqlite = { version = "0.40.0", path="./crates/nu_plugin_from_sqlite", optional=true } nu_plugin_from_sqlite = { version = "0.42.0", path="./crates/nu_plugin_from_sqlite", optional=true }
nu_plugin_inc = { version = "0.40.0", path="./crates/nu_plugin_inc", optional=true } nu_plugin_inc = { version = "0.42.0", path="./crates/nu_plugin_inc", optional=true }
nu_plugin_match = { version = "0.40.0", path="./crates/nu_plugin_match", optional=true } nu_plugin_match = { version = "0.42.0", path="./crates/nu_plugin_match", optional=true }
nu_plugin_query_json = { version = "0.40.0", path="./crates/nu_plugin_query_json", optional=true } nu_plugin_query_json = { version = "0.42.0", path="./crates/nu_plugin_query_json", optional=true }
nu_plugin_s3 = { version = "0.40.0", path="./crates/nu_plugin_s3", optional=true } nu_plugin_s3 = { version = "0.42.0", path="./crates/nu_plugin_s3", optional=true }
nu_plugin_selector = { version = "0.40.0", path="./crates/nu_plugin_selector", optional=true } nu_plugin_selector = { version = "0.42.0", path="./crates/nu_plugin_selector", optional=true }
nu_plugin_start = { version = "0.40.0", path="./crates/nu_plugin_start", optional=true } nu_plugin_start = { version = "0.42.0", path="./crates/nu_plugin_start", optional=true }
nu_plugin_textview = { version = "0.40.0", path="./crates/nu_plugin_textview", optional=true } nu_plugin_textview = { version = "0.42.0", path="./crates/nu_plugin_textview", optional=true }
nu_plugin_to_bson = { version = "0.40.0", path="./crates/nu_plugin_to_bson", optional=true } nu_plugin_to_bson = { version = "0.42.0", path="./crates/nu_plugin_to_bson", optional=true }
nu_plugin_to_sqlite = { version = "0.40.0", path="./crates/nu_plugin_to_sqlite", optional=true } nu_plugin_to_sqlite = { version = "0.42.0", path="./crates/nu_plugin_to_sqlite", optional=true }
nu_plugin_tree = { version = "0.40.0", path="./crates/nu_plugin_tree", optional=true } nu_plugin_tree = { version = "0.42.0", path="./crates/nu_plugin_tree", optional=true }
nu_plugin_xpath = { version = "0.40.0", path="./crates/nu_plugin_xpath", optional=true } nu_plugin_xpath = { version = "0.42.0", path="./crates/nu_plugin_xpath", optional=true }
# Required to bootstrap the main binary # Required to bootstrap the main binary
ctrlc = { version="3.1.7", optional=true } ctrlc = { version="3.1.7", optional=true }
@ -53,7 +53,7 @@ futures = { version="0.3.12", features=["compat", "io-compat"] }
itertools = "0.10.0" itertools = "0.10.0"
[dev-dependencies] [dev-dependencies]
nu-test-support = { version = "0.40.0", path="./crates/nu-test-support" } nu-test-support = { version = "0.42.0", path="./crates/nu-test-support" }
serial_test = "0.5.1" serial_test = "0.5.1"
hamcrest2 = "0.3.0" hamcrest2 = "0.3.0"
rstest = "0.10.0" rstest = "0.10.0"
@ -89,7 +89,6 @@ extra = [
"inc", "inc",
"tree", "tree",
"textview", "textview",
"clipboard-cli",
"trash-support", "trash-support",
"uuid-support", "uuid-support",
"start", "start",
@ -113,7 +112,6 @@ textview = ["nu_plugin_textview"]
binaryview = ["nu_plugin_binaryview"] binaryview = ["nu_plugin_binaryview"]
bson = ["nu_plugin_from_bson", "nu_plugin_to_bson"] bson = ["nu_plugin_from_bson", "nu_plugin_to_bson"]
chart = ["nu_plugin_chart"] chart = ["nu_plugin_chart"]
clipboard-cli = ["nu-command/clipboard-cli"]
query-json = ["nu_plugin_query_json"] query-json = ["nu_plugin_query_json"]
s3 = ["nu_plugin_s3"] s3 = ["nu_plugin_s3"]
selector = ["nu_plugin_selector"] selector = ["nu_plugin_selector"]

View File

@ -10,4 +10,4 @@ Foundational libraries are split into two kinds of crates:
Plugins are likewise also split into two types: Plugins are likewise also split into two types:
* Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features. * Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
* Extra plugins - these plugins run a wide range of differnt capabilities like working with different file types, charting, viewing binary data, and more. * Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.

View File

@ -9,7 +9,7 @@ description = "Library for ANSI terminal colors and styles (bold, underline)"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false

View File

@ -4,24 +4,24 @@ description = "CLI for nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-cli" name = "nu-cli"
version = "0.40.0" version = "0.42.0"
build = "build.rs" build = "build.rs"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-completion = { version = "0.40.0", path="../nu-completion" } nu-completion = { version = "0.42.0", path="../nu-completion" }
nu-command = { version = "0.40.0", path="../nu-command" } nu-command = { version = "0.42.0", path="../nu-command" }
nu-data = { version = "0.40.0", path="../nu-data" } nu-data = { version = "0.42.0", path="../nu-data" }
nu-engine = { version = "0.40.0", path="../nu-engine" } nu-engine = { version = "0.42.0", path="../nu-engine" }
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-parser = { version = "0.40.0", path="../nu-parser" } nu-parser = { version = "0.42.0", path="../nu-parser" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-stream = { version = "0.40.0", path="../nu-stream" } nu-stream = { version = "0.42.0", path="../nu-stream" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
indexmap ="1.6.1" indexmap ="1.6.1"
log = "0.4.14" log = "0.4.14"
@ -29,13 +29,13 @@ pretty_env_logger = "0.4.0"
strip-ansi-escapes = "0.1.0" strip-ansi-escapes = "0.1.0"
rustyline = { version="9.0.0", optional=true } rustyline = { version="9.0.0", optional=true }
ctrlc = { version="3.1.7", optional=true } ctrlc = { version="3.1.7", optional=true }
shadow-rs = { version="0.6", default-features=false, optional=true } shadow-rs = { version = "0.8.1", default-features = false, optional = true }
serde = { version="1.0.123", features=["derive"] } serde = { version="1.0.123", features=["derive"] }
serde_yaml = "0.8.16" serde_yaml = "0.8.16"
lazy_static = "1.4.0" lazy_static = "1.4.0"
[build-dependencies] [build-dependencies]
shadow-rs = "0.6" shadow-rs = "0.8.1"
[features] [features]
default = ["shadow-rs"] default = ["shadow-rs"]

View File

@ -513,11 +513,6 @@ mod tests {
let args = format!("nu --loglevel={}", level); let args = format!("nu --loglevel={}", level);
ui.parse(&args)?; ui.parse(&args)?;
assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string())); assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
let ui = cli_app();
let args = format!("nu -l {}", level);
ui.parse(&args)?;
assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
} }
let ui = cli_app(); let ui = cli_app();
@ -530,6 +525,17 @@ mod tests {
Ok(()) Ok(())
} }
#[test]
fn can_be_login() -> Result<(), ShellError> {
let ui = cli_app();
ui.parse("nu -l")?;
let ui = cli_app();
ui.parse("nu --login")?;
Ok(())
}
#[test] #[test]
fn can_be_passed_nu_scripts() -> Result<(), ShellError> { fn can_be_passed_nu_scripts() -> Result<(), ShellError> {
let ui = cli_app(); let ui = cli_app();

View File

@ -5,35 +5,34 @@ description = "CLI for nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-command" name = "nu-command"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-data = { version = "0.40.0", path="../nu-data" } nu-data = { version = "0.42.0", path="../nu-data" }
nu-engine = { version = "0.40.0", path="../nu-engine" } nu-engine = { version = "0.42.0", path="../nu-engine" }
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-json = { version = "0.40.0", path="../nu-json" } nu-json = { version = "0.42.0", path="../nu-json" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-parser = { version = "0.40.0", path="../nu-parser" } nu-parser = { version = "0.42.0", path="../nu-parser" }
nu-plugin = { version = "0.40.0", path="../nu-plugin" } nu-plugin = { version = "0.42.0", path="../nu-plugin" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-serde = { version = "0.40.0", path="../nu-serde" } nu-serde = { version = "0.42.0", path="../nu-serde" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-stream = { version = "0.40.0", path="../nu-stream" } nu-stream = { version = "0.42.0", path="../nu-stream" }
nu-table = { version = "0.40.0", path="../nu-table" } nu-table = { version = "0.42.0", path="../nu-table" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" } nu-value-ext = { version = "0.42.0", path="../nu-value-ext" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
nu-pretty-hex = { version = "0.40.0", path="../nu-pretty-hex" } nu-pretty-hex = { version = "0.42.0", path="../nu-pretty-hex" }
url = "2.2.1" url = "2.2.1"
mime = "0.3.16" mime = "0.3.16"
Inflector = "0.11" heck = "0.4.0"
arboard = { version="1.1.0", optional=true }
base64 = "0.13.0" base64 = "0.13.0"
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { version = "0.3.0", features = ["serde"] }
calamine = "0.18.0" calamine = "0.18.0"
chrono = { version="0.4.19", features=["serde"] } chrono = { version="0.4.19", features=["serde"] }
chrono-tz = "0.5.3" chrono-tz = "0.5.3"
@ -56,7 +55,7 @@ lazy_static = "1.*"
log = "0.4.14" log = "0.4.14"
md-5 = "0.9.1" md-5 = "0.9.1"
meval = "0.2.0" meval = "0.2.0"
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
num-format = { version="0.4.0", features=["with-num-bigint"] } num-format = { version="0.4.0", features=["with-num-bigint"] }
num-traits = "0.2.14" num-traits = "0.2.14"
parking_lot = "0.11.1" parking_lot = "0.11.1"
@ -74,14 +73,14 @@ serde_urlencoded = "0.7.0"
serde_yaml = "0.8.16" serde_yaml = "0.8.16"
sha2 = "0.9.3" sha2 = "0.9.3"
strip-ansi-escapes = "0.1.0" strip-ansi-escapes = "0.1.0"
sysinfo = { version = "0.20.2", optional = true } sysinfo = { version = "0.21.2", optional = true }
thiserror = "1.0.26" thiserror = "1.0.26"
term = { version="0.7.0", optional=true } term = { version="0.7.0", optional=true }
term_size = "0.3.2" term_size = "0.3.2"
titlecase = "1.1.0" titlecase = "1.1.0"
tokio = { version = "1", features = ["rt-multi-thread"], optional = true } tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
toml = "0.5.8" toml = "0.5.8"
trash = { version="1.3.0", optional=true } trash = { version = "2.0.2", optional = true }
unicode-segmentation = "1.8" unicode-segmentation = "1.8"
uuid_crate = { package="uuid", version="0.8.2", features=["v4"], optional=true } uuid_crate = { package="uuid", version="0.8.2", features=["v4"], optional=true }
which = { version="4.1.0", optional=true } which = { version="4.1.0", optional=true }
@ -91,7 +90,8 @@ digest = "0.9.0"
[dependencies.polars] [dependencies.polars]
version = "0.17.0" version = "0.17.0"
optional = true optional = true
features = ["parquet", "json", "random", "pivot", "strings", "is_in", "temporal", "cum_agg", "rolling_window"] default-features = false
features = ["docs", "zip_with", "csv-file", "temporal", "performant", "pretty_fmt", "dtype-slim", "parquet", "json", "random", "pivot", "strings", "is_in", "cum_agg", "rolling_window"]
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
umask = "1.0.0" umask = "1.0.0"
@ -104,7 +104,7 @@ users = "0.11.0"
# num-format = { version = "0.4", features = ["with-system-locale"] } # num-format = { version = "0.4", features = ["with-system-locale"] }
[build-dependencies] [build-dependencies]
shadow-rs = "0.6" shadow-rs = "0.8.1"
[dev-dependencies] [dev-dependencies]
quickcheck = "1.0.3" quickcheck = "1.0.3"
@ -112,7 +112,6 @@ quickcheck_macros = "1.0.0"
hamcrest2 = "0.3.0" hamcrest2 = "0.3.0"
[features] [features]
clipboard-cli = ["arboard"]
rustyline-support = ["rustyline"] rustyline-support = ["rustyline"]
stable = [] stable = []
trash-support = ["trash"] trash-support = ["trash"]

View File

@ -1,7 +0,0 @@
use derive_new::new;
use nu_protocol::hir;
#[derive(new, Debug)]
pub(crate) struct Command {
pub(crate) args: hir::Call,
}

View File

@ -1,8 +1,10 @@
use crate::prelude::*; use crate::prelude::*;
use lazy_static::lazy_static;
use nu_engine::{evaluate_baseline_expr, BufCodecReader}; use nu_engine::{evaluate_baseline_expr, BufCodecReader};
use nu_engine::{MaybeTextCodec, StringOrBinary}; use nu_engine::{MaybeTextCodec, StringOrBinary};
use nu_test_support::NATIVE_PATH_ENV_VAR; use nu_test_support::NATIVE_PATH_ENV_VAR;
use parking_lot::Mutex; use parking_lot::Mutex;
use regex::Regex;
#[allow(unused)] #[allow(unused)]
use std::env; use std::env;
@ -44,20 +46,16 @@ pub(crate) fn run_external_command(
} }
#[allow(unused)] #[allow(unused)]
fn trim_double_quotes(input: &str) -> String { fn trim_enclosing_quotes(input: &str) -> String {
let mut chars = input.chars(); let mut chars = input.chars();
match (chars.next(), chars.next_back()) { match (chars.next(), chars.next_back()) {
(Some('"'), Some('"')) => chars.collect(), (Some('"'), Some('"')) => chars.collect(),
(Some('\''), Some('\'')) => chars.collect(),
_ => input.to_string(), _ => input.to_string(),
} }
} }
#[allow(unused)]
fn escape_where_needed(input: &str) -> String {
input.split(' ').join("\\ ").split('\'').join("\\'")
}
fn run_with_stdin( fn run_with_stdin(
command: ExternalCommand, command: ExternalCommand,
context: &mut EvaluationContext, context: &mut EvaluationContext,
@ -115,15 +113,9 @@ fn run_with_stdin(
#[cfg(not(windows))] #[cfg(not(windows))]
{ {
if !_is_literal { if !_is_literal {
let escaped = escape_double_quotes(&arg); arg
add_double_quotes(&escaped)
} else { } else {
let trimmed = trim_double_quotes(&arg); trim_enclosing_quotes(&arg)
if trimmed != arg {
escape_where_needed(&trimmed)
} else {
trimmed
}
} }
} }
#[cfg(windows)] #[cfg(windows)]
@ -131,7 +123,7 @@ fn run_with_stdin(
if let Some(unquoted) = remove_quotes(&arg) { if let Some(unquoted) = remove_quotes(&arg) {
unquoted.to_string() unquoted.to_string()
} else { } else {
arg.to_string() arg
} }
} }
}) })
@ -172,9 +164,29 @@ fn spawn_cmd_command(command: &ExternalCommand, args: &[String]) -> Command {
process process
} }
fn has_unsafe_shell_characters(arg: &str) -> bool {
lazy_static! {
static ref RE: Regex = Regex::new(r"[^\w@%+=:,./-]").expect("regex to be valid");
}
RE.is_match(arg)
}
fn shell_arg_escape(arg: &str) -> String {
match arg {
"" => String::from("''"),
s if !has_unsafe_shell_characters(s) => String::from(s),
_ => {
let single_quotes_escaped = arg.split('\'').join("'\"'\"'");
format!("'{}'", single_quotes_escaped)
}
}
}
/// Spawn a sh command with `sh -c args...` /// Spawn a sh command with `sh -c args...`
fn spawn_sh_command(command: &ExternalCommand, args: &[String]) -> Command { fn spawn_sh_command(command: &ExternalCommand, args: &[String]) -> Command {
let cmd_with_args = vec![command.name.clone(), args.join(" ")].join(" "); let joined_and_escaped_arguments = args.iter().map(|arg| shell_arg_escape(arg)).join(" ");
let cmd_with_args = vec![command.name.clone(), joined_and_escaped_arguments].join(" ");
let mut process = Command::new("sh"); let mut process = Command::new("sh");
process.arg("-c").arg(cmd_with_args); process.arg("-c").arg(cmd_with_args);
process process

View File

@ -1,5 +1 @@
mod dynamic;
pub(crate) mod external; pub(crate) mod external;
#[allow(unused_imports)]
pub(crate) use dynamic::Command as DynamicCommand;

View File

@ -7,14 +7,14 @@ pub struct SubCommand;
impl WholeStreamCommand for SubCommand { impl WholeStreamCommand for SubCommand {
fn name(&self) -> &str { fn name(&self) -> &str {
"into column_path" "into column-path"
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("into column_path").rest( Signature::build("into column-path").rest(
"rest", "rest",
SyntaxShape::ColumnPath, SyntaxShape::ColumnPath,
"values to convert to column_path", "values to convert to column path",
) )
} }
@ -29,8 +29,8 @@ impl WholeStreamCommand for SubCommand {
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {
description: "Convert string to column_path in table", description: "Convert string to column path in table",
example: "echo [[name]; ['/dev/null'] ['C:\\Program Files'] ['../../Cargo.toml']] | into column_path name", example: "echo [[name]; ['/dev/null'] ['C:\\Program Files'] ['../../Cargo.toml']] | into column-path name",
result: Some(vec![ result: Some(vec![
UntaggedValue::row(indexmap! { UntaggedValue::row(indexmap! {
"name".to_string() => UntaggedValue::column_path("/dev/null", Span::unknown()).into(), "name".to_string() => UntaggedValue::column_path("/dev/null", Span::unknown()).into(),
@ -47,8 +47,8 @@ impl WholeStreamCommand for SubCommand {
]), ]),
}, },
Example { Example {
description: "Convert string to column_path", description: "Convert string to column path",
example: "echo 'Cargo.toml' | into column_path", example: "echo 'Cargo.toml' | into column-path",
result: Some(vec![UntaggedValue::column_path("Cargo.toml", Span::unknown()).into()]), result: Some(vec![UntaggedValue::column_path("Cargo.toml", Span::unknown()).into()]),
}, },
] ]
@ -86,7 +86,7 @@ pub fn action(input: &Value, tag: impl Into<Tag>) -> Result<Value, ShellError> {
Primitive::String(a_string) => a_string, Primitive::String(a_string) => a_string,
_ => { _ => {
return Err(ShellError::unimplemented( return Err(ShellError::unimplemented(
"'into column_path' for non-string primitives", "'into column-path' for non-string primitives",
)) ))
} }
}, },
@ -94,12 +94,12 @@ pub fn action(input: &Value, tag: impl Into<Tag>) -> Result<Value, ShellError> {
) )
.into_value(&tag)), .into_value(&tag)),
UntaggedValue::Row(_) => Err(ShellError::labeled_error( UntaggedValue::Row(_) => Err(ShellError::labeled_error(
"specify column name to use, with 'into column_path COLUMN'", "specify column name to use, with 'into column-path COLUMN'",
"found table", "found table",
tag, tag,
)), )),
_ => Err(ShellError::unimplemented( _ => Err(ShellError::unimplemented(
"'into column_path' for unsupported type", "'into column-path' for unsupported type",
)), )),
} }
} }

View File

@ -15,6 +15,7 @@ impl WholeStreamCommand for Command {
.switch("skip-plugins", "do not load plugins", None) .switch("skip-plugins", "do not load plugins", None)
.switch("no-history", "don't save history", None) .switch("no-history", "don't save history", None)
.switch("perf", "show startup performance metrics", None) .switch("perf", "show startup performance metrics", None)
.switch("login", "start Nu as if it was a login shell", Some('l'))
.named( .named(
"commands", "commands",
SyntaxShape::String, SyntaxShape::String,
@ -33,7 +34,7 @@ impl WholeStreamCommand for Command {
"loglevel", "loglevel",
SyntaxShape::String, SyntaxShape::String,
"LEVEL: error, warn, info, debug, trace", "LEVEL: error, warn, info, debug, trace",
Some('l'), None,
) )
.named( .named(
"config-file", "config-file",

View File

@ -221,11 +221,6 @@ fn features_enabled() -> Vec<String> {
names.push("zip".to_string()); names.push("zip".to_string());
} }
#[cfg(feature = "clipboard-cli")]
{
names.push("clipboard-cli".to_string());
}
#[cfg(feature = "trash-support")] #[cfg(feature = "trash-support")]
{ {
names.push("trash".to_string()); names.push("trash".to_string());

View File

@ -11,12 +11,6 @@ use nu_protocol::{
pub struct WithEnv; pub struct WithEnv;
#[derive(Deserialize, Debug)]
struct WithEnvArgs {
variable: Value,
block: CapturedBlock,
}
impl WholeStreamCommand for WithEnv { impl WholeStreamCommand for WithEnv {
fn name(&self) -> &str { fn name(&self) -> &str {
"with-env" "with-env"

View File

@ -163,7 +163,7 @@ fn get_current_date() -> (i32, u32, u32) {
fn add_months_of_year_to_table( fn add_months_of_year_to_table(
args: &CommandArgs, args: &CommandArgs,
mut calendar_vec_deque: &mut VecDeque<Value>, calendar_vec_deque: &mut VecDeque<Value>,
tag: &Tag, tag: &Tag,
selected_year: i32, selected_year: i32,
(start_month, end_month): (u32, u32), (start_month, end_month): (u32, u32),
@ -181,7 +181,7 @@ fn add_months_of_year_to_table(
let add_month_to_table_result = add_month_to_table( let add_month_to_table_result = add_month_to_table(
args, args,
&mut calendar_vec_deque, calendar_vec_deque,
tag, tag,
selected_year, selected_year,
month_number, month_number,

View File

@ -36,6 +36,7 @@ impl WholeStreamCommand for Command {
Some('p'), Some('p'),
) )
.switch("raw", "fetch contents as text rather than a table", Some('r')) .switch("raw", "fetch contents as text rather than a table", Some('r'))
.switch("insecure", "allow insecure server connections when using SSL", Some('k'))
.filter() .filter()
} }
@ -78,6 +79,7 @@ fn run_fetch(args: CommandArgs) -> Result<ActionStream, ShellError> {
) )
})?, })?,
fetch_helper.has_raw, fetch_helper.has_raw,
fetch_helper.has_insecure,
fetch_helper.user.clone(), fetch_helper.user.clone(),
fetch_helper.password, fetch_helper.password,
))] ))]
@ -92,6 +94,7 @@ pub struct Fetch {
pub path: Option<Value>, pub path: Option<Value>,
pub tag: Tag, pub tag: Tag,
pub has_raw: bool, pub has_raw: bool,
pub has_insecure: bool,
pub user: Option<String>, pub user: Option<String>,
pub password: Option<String>, pub password: Option<String>,
} }
@ -102,6 +105,7 @@ impl Fetch {
path: None, path: None,
tag: Tag::unknown(), tag: Tag::unknown(),
has_raw: false, has_raw: false,
has_insecure: false,
user: None, user: None,
password: None, password: None,
} }
@ -121,6 +125,8 @@ impl Fetch {
self.has_raw = args.has_flag("raw"); self.has_raw = args.has_flag("raw");
self.has_insecure = args.has_flag("insecure");
self.user = args.get_flag("user")?; self.user = args.get_flag("user")?;
self.password = args.get_flag("password")?; self.password = args.get_flag("password")?;
@ -132,13 +138,14 @@ impl Fetch {
pub async fn fetch( pub async fn fetch(
path: &Value, path: &Value,
has_raw: bool, has_raw: bool,
has_insecure: bool,
user: Option<String>, user: Option<String>,
password: Option<String>, password: Option<String>,
) -> ReturnValue { ) -> ReturnValue {
let path_str = path.as_string()?; let path_str = path.as_string()?;
let path_span = path.tag.span; let path_span = path.tag.span;
let result = helper(&path_str, path_span, has_raw, user, password).await; let result = helper(&path_str, path_span, has_raw, has_insecure, user, password).await;
if let Err(e) = result { if let Err(e) = result {
return Err(e); return Err(e);
@ -168,6 +175,7 @@ async fn helper(
location: &str, location: &str,
span: Span, span: Span,
has_raw: bool, has_raw: bool,
has_insecure: bool,
user: Option<String>, user: Option<String>,
password: Option<String>, password: Option<String>,
) -> std::result::Result<(Option<String>, Value), ShellError> { ) -> std::result::Result<(Option<String>, Value), ShellError> {
@ -188,7 +196,7 @@ async fn helper(
_ => None, _ => None,
}; };
let client = http_client(); let client = http_client(has_insecure);
let mut request = client.get(url); let mut request = client.get(url);
if let Some(login) = login { if let Some(login) = login {
@ -360,10 +368,10 @@ async fn helper(
// Only panics if the user agent is invalid but we define it statically so either // Only panics if the user agent is invalid but we define it statically so either
// it always or never fails // it always or never fails
#[allow(clippy::unwrap_used)] fn http_client(allow_insecure: bool) -> reqwest::Client {
fn http_client() -> reqwest::Client {
reqwest::Client::builder() reqwest::Client::builder()
.user_agent("nushell") .user_agent("nushell")
.danger_accept_invalid_certs(allow_insecure)
.build() .build()
.unwrap() .expect("Failed to build reqwest client")
} }

View File

@ -53,6 +53,11 @@ impl WholeStreamCommand for Command {
"return values as a string instead of a table", "return values as a string instead of a table",
Some('r'), Some('r'),
) )
.switch(
"insecure",
"allow insecure server connections when using SSL",
Some('k'),
)
.filter() .filter()
} }
@ -91,6 +96,7 @@ fn run_post(args: CommandArgs) -> Result<ActionStream, ShellError> {
ShellError::labeled_error("expected a 'path'", "expected a 'path'", &helper.tag) ShellError::labeled_error("expected a 'path'", "expected a 'path'", &helper.tag)
})?, })?,
helper.has_raw, helper.has_raw,
helper.has_insecure,
&helper.body.clone().ok_or_else(|| { &helper.body.clone().ok_or_else(|| {
ShellError::labeled_error("expected a 'body'", "expected a 'body'", &helper.tag) ShellError::labeled_error("expected a 'body'", "expected a 'body'", &helper.tag)
})?, })?,
@ -114,6 +120,7 @@ pub enum HeaderKind {
pub struct Post { pub struct Post {
pub path: Option<Value>, pub path: Option<Value>,
pub has_raw: bool, pub has_raw: bool,
pub has_insecure: bool,
pub body: Option<Value>, pub body: Option<Value>,
pub user: Option<String>, pub user: Option<String>,
pub password: Option<String>, pub password: Option<String>,
@ -126,6 +133,7 @@ impl Post {
Post { Post {
path: None, path: None,
has_raw: false, has_raw: false,
has_insecure: false,
body: None, body: None,
user: None, user: None,
password: None, password: None,
@ -156,6 +164,8 @@ impl Post {
self.has_raw = args.has_flag("raw"); self.has_raw = args.has_flag("raw");
self.has_insecure = args.has_flag("insecure");
self.user = args.get_flag("user")?; self.user = args.get_flag("user")?;
self.password = args.get_flag("password")?; self.password = args.get_flag("password")?;
@ -169,6 +179,7 @@ impl Post {
pub async fn post_helper( pub async fn post_helper(
path: &Value, path: &Value,
has_raw: bool, has_raw: bool,
has_insecure: bool,
body: &Value, body: &Value,
user: Option<String>, user: Option<String>,
password: Option<String>, password: Option<String>,
@ -177,8 +188,16 @@ pub async fn post_helper(
let path_tag = path.tag.clone(); let path_tag = path.tag.clone();
let path_str = path.as_string()?; let path_str = path.as_string()?;
let (file_extension, contents, contents_tag) = let (file_extension, contents, contents_tag) = post(
post(&path_str, body, user, password, headers, path_tag.clone()).await?; &path_str,
has_insecure,
body,
user,
password,
headers,
path_tag.clone(),
)
.await?;
let file_extension = if has_raw { let file_extension = if has_raw {
None None
@ -202,6 +221,7 @@ pub async fn post_helper(
pub async fn post( pub async fn post(
location: &str, location: &str,
allow_insecure: bool,
body: &Value, body: &Value,
user: Option<String>, user: Option<String>,
password: Option<String>, password: Option<String>,
@ -219,7 +239,9 @@ pub async fn post(
value: UntaggedValue::Primitive(Primitive::String(body_str)), value: UntaggedValue::Primitive(Primitive::String(body_str)),
.. ..
} => { } => {
let mut s = http_client().post(location).body(body_str.to_string()); let mut s = http_client(allow_insecure)
.post(location)
.body(body_str.to_string());
if let Some(login) = login { if let Some(login) = login {
s = s.header("Authorization", format!("Basic {}", login)); s = s.header("Authorization", format!("Basic {}", login));
} }
@ -237,7 +259,9 @@ pub async fn post(
value: UntaggedValue::Primitive(Primitive::Binary(b)), value: UntaggedValue::Primitive(Primitive::Binary(b)),
.. ..
} => { } => {
let mut s = http_client().post(location).body(Vec::from(&b[..])); let mut s = http_client(allow_insecure)
.post(location)
.body(Vec::from(&b[..]));
if let Some(login) = login { if let Some(login) = login {
s = s.header("Authorization", format!("Basic {}", login)); s = s.header("Authorization", format!("Basic {}", login));
} }
@ -247,7 +271,9 @@ pub async fn post(
match value_to_json_value(&value.clone().into_untagged_value()) { match value_to_json_value(&value.clone().into_untagged_value()) {
Ok(json_value) => match serde_json::to_string(&json_value) { Ok(json_value) => match serde_json::to_string(&json_value) {
Ok(result_string) => { Ok(result_string) => {
let mut s = http_client().post(location).body(result_string); let mut s = http_client(allow_insecure)
.post(location)
.body(result_string);
if let Some(login) = login { if let Some(login) = login {
s = s.header("Authorization", format!("Basic {}", login)); s = s.header("Authorization", format!("Basic {}", login));
@ -611,10 +637,10 @@ fn extract_header_value(args: &CommandArgs, key: &str) -> Result<Option<String>,
// Only panics if the user agent is invalid but we define it statically so either // Only panics if the user agent is invalid but we define it statically so either
// it always or never fails // it always or never fails
#[allow(clippy::unwrap_used)] fn http_client(allow_insecure: bool) -> reqwest::Client {
fn http_client() -> reqwest::Client {
reqwest::Client::builder() reqwest::Client::builder()
.user_agent("nushell") .user_agent("nushell")
.danger_accept_invalid_certs(allow_insecure)
.build() .build()
.unwrap() .expect("Failed to build reqwest client")
} }

View File

@ -170,7 +170,7 @@ fn action(
Ok(UntaggedValue::string(gradient_string).into_value(tag)) Ok(UntaggedValue::string(gradient_string).into_value(tag))
} }
(None, Some(fg_end), None, Some(bg_end)) => { (None, Some(fg_end), None, Some(bg_end)) => {
// missin fg_start and bg_start, so assume black // missing fg_start and bg_start, so assume black
let fg_start = Rgb::new(0, 0, 0); let fg_start = Rgb::new(0, 0, 0);
let bg_start = Rgb::new(0, 0, 0); let bg_start = Rgb::new(0, 0, 0);
let fg_gradient = Gradient::new(fg_start, fg_end); let fg_gradient = Gradient::new(fg_start, fg_end);

View File

@ -1,105 +0,0 @@
use crate::prelude::*;
use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Signature, Value};
use arboard::Clipboard;
pub struct Clip;
impl WholeStreamCommand for Clip {
fn name(&self) -> &str {
"clip"
}
fn signature(&self) -> Signature {
Signature::build("clip")
}
fn usage(&self) -> &str {
"Copy the contents of the pipeline to the copy/paste buffer."
}
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
clip(args)
}
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "Save text to the clipboard",
example: "echo 'secret value' | clip",
result: None,
},
Example {
description: "Save numbers to the clipboard",
example: "random integer 10000000..99999999 | clip",
result: None,
},
]
}
}
pub fn clip(args: CommandArgs) -> Result<ActionStream, ShellError> {
let input = args.input;
let name = args.call_info.name_tag;
let values: Vec<Value> = input.collect();
if let Ok(mut clip_context) = Clipboard::new() {
let mut new_copy_data = String::new();
if !values.is_empty() {
let mut first = true;
for i in &values {
if !first {
new_copy_data.push('\n');
} else {
first = false;
}
let string: String = i.convert_to_string();
if string.is_empty() {
return Err(ShellError::labeled_error(
"Unable to convert to string",
"Unable to convert to string",
name,
));
}
new_copy_data.push_str(&string);
}
}
match clip_context.set_text(new_copy_data) {
Ok(_) => {}
Err(_) => {
return Err(ShellError::labeled_error(
"Could not set contents of clipboard",
"could not set contents of clipboard",
name,
));
}
}
} else {
return Err(ShellError::labeled_error(
"Could not open clipboard",
"could not open clipboard",
name,
));
}
Ok(ActionStream::empty())
}
#[cfg(test)]
mod tests {
use super::Clip;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(Clip {})
}
}

View File

@ -1,13 +1,9 @@
mod ansi; mod ansi;
mod benchmark; mod benchmark;
mod clear; mod clear;
#[cfg(feature = "clipboard-cli")]
mod clip;
mod du; mod du;
mod exec; mod exec;
mod kill; mod kill;
#[cfg(feature = "clipboard-cli")]
mod paste;
mod pwd; mod pwd;
mod run_external; mod run_external;
mod sleep; mod sleep;
@ -17,13 +13,9 @@ mod which_;
pub use ansi::*; pub use ansi::*;
pub use benchmark::Benchmark; pub use benchmark::Benchmark;
pub use clear::Clear; pub use clear::Clear;
#[cfg(feature = "clipboard-cli")]
pub use clip::Clip;
pub use du::Du; pub use du::Du;
pub use exec::Exec; pub use exec::Exec;
pub use kill::Kill; pub use kill::Kill;
#[cfg(feature = "clipboard-cli")]
pub use paste::Paste;
pub use pwd::Pwd; pub use pwd::Pwd;
pub use run_external::RunExternalCommand; pub use run_external::RunExternalCommand;
pub use sleep::Sleep; pub use sleep::Sleep;

View File

@ -1,61 +0,0 @@
use crate::prelude::*;
use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, UntaggedValue};
use arboard::Clipboard;
pub struct Paste;
impl WholeStreamCommand for Paste {
fn name(&self) -> &str {
"paste"
}
fn signature(&self) -> Signature {
Signature::build("paste")
}
fn usage(&self) -> &str {
"Paste contents from the clipboard"
}
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
paste(args)
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Paste text from your clipboard",
example: "echo 'secret value' | clip | paste",
result: Some(vec![UntaggedValue::Primitive(Primitive::String(
"secret value".to_owned(),
))
.into_value(Tag::default())]),
}]
}
}
pub fn paste(args: CommandArgs) -> Result<ActionStream, ShellError> {
let name = args.call_info.name_tag;
if let Ok(mut clip_context) = Clipboard::new() {
match clip_context.get_text() {
Ok(out) => Ok(ActionStream::one(ReturnSuccess::value(
UntaggedValue::Primitive(Primitive::String(out)),
))),
Err(_) => Err(ShellError::labeled_error(
"Could not get contents of clipboard",
"could not get contents of clipboard",
name,
)),
}
} else {
Err(ShellError::labeled_error(
"Could not open clipboard",
"could not open clipboard",
name,
))
}
}

View File

@ -6,12 +6,6 @@ use nu_protocol::{Dictionary, Signature, UntaggedValue};
pub struct TermSize; pub struct TermSize;
#[derive(Deserialize, Clone)]
pub struct TermSizeArgs {
wide: bool,
tall: bool,
}
impl WholeStreamCommand for TermSize { impl WholeStreamCommand for TermSize {
fn name(&self) -> &str { fn name(&self) -> &str {
"term size" "term size"

View File

@ -1,6 +1,5 @@
use super::operate; use super::{operate, to_lower_camel_case};
use crate::prelude::*; use crate::prelude::*;
use inflector::cases::camelcase::to_camel_case;
use nu_engine::WholeStreamCommand; use nu_engine::WholeStreamCommand;
use nu_errors::ShellError; use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, Value}; use nu_protocol::{Signature, SyntaxShape, Value};
@ -25,7 +24,7 @@ impl WholeStreamCommand for SubCommand {
} }
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> { fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
operate(args, &to_camel_case) operate(args, &to_lower_camel_case)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
@ -40,7 +39,7 @@ impl WholeStreamCommand for SubCommand {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::ShellError; use super::ShellError;
use super::{to_camel_case, SubCommand}; use super::{to_lower_camel_case, SubCommand};
use crate::commands::strings::str_::case::action; use crate::commands::strings::str_::case::action;
use nu_source::Tag; use nu_source::Tag;
use nu_test_support::value::string; use nu_test_support::value::string;
@ -57,7 +56,7 @@ mod tests {
let word = string("this-is-the-first-case"); let word = string("this-is-the-first-case");
let expected = string("thisIsTheFirstCase"); let expected = string("thisIsTheFirstCase");
let actual = action(&word, Tag::unknown(), &to_camel_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_lower_camel_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
#[test] #[test]
@ -65,7 +64,7 @@ mod tests {
let word = string("this_is_the_second_case"); let word = string("this_is_the_second_case");
let expected = string("thisIsTheSecondCase"); let expected = string("thisIsTheSecondCase");
let actual = action(&word, Tag::unknown(), &to_camel_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_lower_camel_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
} }

View File

@ -1,6 +1,5 @@
use super::operate; use super::{operate, to_kebab_case};
use crate::prelude::*; use crate::prelude::*;
use inflector::cases::kebabcase::to_kebab_case;
use nu_engine::WholeStreamCommand; use nu_engine::WholeStreamCommand;
use nu_errors::ShellError; use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, Value}; use nu_protocol::{Signature, SyntaxShape, Value};

View File

@ -16,6 +16,24 @@ pub use pascal_case::SubCommand as PascalCase;
pub use screaming_snake_case::SubCommand as ScreamingSnakeCase; pub use screaming_snake_case::SubCommand as ScreamingSnakeCase;
pub use snake_case::SubCommand as SnakeCase; pub use snake_case::SubCommand as SnakeCase;
use heck::ToKebabCase;
use heck::ToLowerCamelCase;
use heck::ToShoutySnakeCase;
use heck::ToSnakeCase;
use heck::ToUpperCamelCase;
macro_rules! create_heck_function {
($func_name:ident) => {
pub fn $func_name(a_slice: &str) -> String {
a_slice.$func_name()
}
};
}
create_heck_function!(to_upper_camel_case);
create_heck_function!(to_lower_camel_case);
create_heck_function!(to_kebab_case);
create_heck_function!(to_shouty_snake_case);
create_heck_function!(to_snake_case);
struct Arguments { struct Arguments {
column_paths: Vec<ColumnPath>, column_paths: Vec<ColumnPath>,
} }

View File

@ -1,6 +1,5 @@
use super::operate; use super::{operate, to_upper_camel_case};
use crate::prelude::*; use crate::prelude::*;
use inflector::cases::pascalcase::to_pascal_case;
use nu_engine::WholeStreamCommand; use nu_engine::WholeStreamCommand;
use nu_errors::ShellError; use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, Value}; use nu_protocol::{Signature, SyntaxShape, Value};
@ -25,7 +24,7 @@ impl WholeStreamCommand for SubCommand {
} }
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> { fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
operate(args, &to_pascal_case) operate(args, &to_upper_camel_case)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
@ -40,7 +39,7 @@ impl WholeStreamCommand for SubCommand {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::ShellError; use super::ShellError;
use super::{to_pascal_case, SubCommand}; use super::{to_upper_camel_case, SubCommand};
use crate::commands::strings::str_::case::action; use crate::commands::strings::str_::case::action;
use nu_source::Tag; use nu_source::Tag;
use nu_test_support::value::string; use nu_test_support::value::string;
@ -57,7 +56,7 @@ mod tests {
let word = string("this-is-the-first-case"); let word = string("this-is-the-first-case");
let expected = string("ThisIsTheFirstCase"); let expected = string("ThisIsTheFirstCase");
let actual = action(&word, Tag::unknown(), &to_pascal_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_upper_camel_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
#[test] #[test]
@ -65,7 +64,7 @@ mod tests {
let word = string("this_is_the_second_case"); let word = string("this_is_the_second_case");
let expected = string("ThisIsTheSecondCase"); let expected = string("ThisIsTheSecondCase");
let actual = action(&word, Tag::unknown(), &to_pascal_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_upper_camel_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
} }

View File

@ -1,6 +1,5 @@
use super::operate; use super::{operate, to_shouty_snake_case};
use crate::prelude::*; use crate::prelude::*;
use inflector::cases::screamingsnakecase::to_screaming_snake_case;
use nu_engine::WholeStreamCommand; use nu_engine::WholeStreamCommand;
use nu_errors::ShellError; use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, Value}; use nu_protocol::{Signature, SyntaxShape, Value};
@ -25,7 +24,7 @@ impl WholeStreamCommand for SubCommand {
} }
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> { fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
operate(args, &to_screaming_snake_case) operate(args, &to_shouty_snake_case)
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
@ -40,7 +39,7 @@ impl WholeStreamCommand for SubCommand {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::ShellError; use super::ShellError;
use super::{to_screaming_snake_case, SubCommand}; use super::{to_shouty_snake_case, SubCommand};
use crate::commands::strings::str_::case::action; use crate::commands::strings::str_::case::action;
use nu_source::Tag; use nu_source::Tag;
use nu_test_support::value::string; use nu_test_support::value::string;
@ -57,7 +56,7 @@ mod tests {
let word = string("this-is-the-first-case"); let word = string("this-is-the-first-case");
let expected = string("THIS_IS_THE_FIRST_CASE"); let expected = string("THIS_IS_THE_FIRST_CASE");
let actual = action(&word, Tag::unknown(), &to_screaming_snake_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_shouty_snake_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
#[test] #[test]
@ -65,7 +64,7 @@ mod tests {
let word = string("this_is_the_second_case"); let word = string("this_is_the_second_case");
let expected = string("THIS_IS_THE_SECOND_CASE"); let expected = string("THIS_IS_THE_SECOND_CASE");
let actual = action(&word, Tag::unknown(), &to_screaming_snake_case).unwrap(); let actual = action(&word, Tag::unknown(), &to_shouty_snake_case).unwrap();
assert_eq!(actual, expected); assert_eq!(actual, expected);
} }
} }

View File

@ -1,6 +1,5 @@
use super::operate; use super::{operate, to_snake_case};
use crate::prelude::*; use crate::prelude::*;
use inflector::cases::snakecase::to_snake_case;
use nu_engine::WholeStreamCommand; use nu_engine::WholeStreamCommand;
use nu_errors::ShellError; use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, Value}; use nu_protocol::{Signature, SyntaxShape, Value};

View File

@ -144,7 +144,7 @@ fn trim(s: &str, char_: Option<char>, closure_flags: &ClosureFlags) -> String {
let re_str = format!("{}{{2,}}", reg); let re_str = format!("{}{{2,}}", reg);
// create the regex // create the regex
let re = regex::Regex::new(&re_str).expect("Error creating regular expression"); let re = regex::Regex::new(&re_str).expect("Error creating regular expression");
// replace all mutliple occurances with single occurences represented by r // replace all multiple occurrences with single occurrences represented by r
let new_str = re.replace_all(&return_string, r.to_string()); let new_str = re.replace_all(&return_string, r.to_string());
// update the return string so the next loop has the latest changes // update the return string so the next loop has the latest changes
return_string = new_str.to_string(); return_string = new_str.to_string();

View File

@ -366,14 +366,6 @@ pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Bo
whole_stream_command(DataFrameCumulative), whole_stream_command(DataFrameCumulative),
whole_stream_command(DataFrameRename), whole_stream_command(DataFrameRename),
]); ]);
#[cfg(feature = "clipboard-cli")]
{
context.add_commands(vec![
whole_stream_command(crate::commands::Clip),
whole_stream_command(crate::commands::Paste),
]);
}
} }
Ok(context) Ok(context)

View File

@ -47,3 +47,21 @@ fn writes_out_csv() {
assert!(actual.contains("nu,0.14,A new type of shell,MIT,2018")); assert!(actual.contains("nu,0.14,A new type of shell,MIT,2018"));
}) })
} }
#[test]
fn save_append_will_create_file_if_not_exists() {
Playground::setup("save_test_3", |dirs, sandbox| {
sandbox.with_files(vec![]);
let expected_file = dirs.test().join("new-file.txt");
nu!(
cwd: dirs.root(),
r#"echo hello | save --raw --append save_test_3/new-file.txt"#,
);
let actual = file_contents(expected_file);
println!("{}", actual);
assert!(actual == "hello");
})
}

View File

@ -4,19 +4,19 @@ description = "Completions for nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-completion" name = "nu-completion"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-engine = { version = "0.40.0", path="../nu-engine" } nu-engine = { version = "0.42.0", path="../nu-engine" }
nu-data = { version = "0.40.0", path="../nu-data" } nu-data = { version = "0.42.0", path="../nu-data" }
nu-parser = { version = "0.40.0", path="../nu-parser" } nu-parser = { version = "0.42.0", path="../nu-parser" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -4,13 +4,13 @@ description = "CLI for nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-data" name = "nu-data"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
byte-unit = "4.0.9" byte-unit = "4.0.9"
chrono = "0.4.19" chrono = "0.4.19"
common-path = "1.0.0" common-path = "1.0.0"
@ -19,7 +19,7 @@ directories-next = "2.0.0"
getset = "0.1.1" getset = "0.1.1"
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
log = "0.4.14" log = "0.4.14"
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
num-format = "0.4.0" num-format = "0.4.0"
num-traits = "0.2.14" num-traits = "0.2.14"
serde = { version="1.0.123", features=["derive"] } serde = { version="1.0.123", features=["derive"] }
@ -27,14 +27,14 @@ sha2 = "0.9.3"
sys-locale = "0.1.0" sys-locale = "0.1.0"
toml = "0.5.8" toml = "0.5.8"
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-table = { version = "0.40.0", path="../nu-table" } nu-table = { version = "0.42.0", path="../nu-table" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" } nu-value-ext = { version = "0.42.0", path="../nu-value-ext" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
[features] [features]
dataframe = ["nu-protocol/dataframe"] dataframe = ["nu-protocol/dataframe"]

View File

@ -164,8 +164,8 @@ pub fn coerce_compare_primitive(
(Date(left), Date(right)) => CompareValues::Date(*left, *right), (Date(left), Date(right)) => CompareValues::Date(*left, *right),
(Date(left), Duration(right)) => CompareValues::DateDuration(*left, right.clone()), (Date(left), Duration(right)) => CompareValues::DateDuration(*left, right.clone()),
(Boolean(left), Boolean(right)) => CompareValues::Booleans(*left, *right), (Boolean(left), Boolean(right)) => CompareValues::Booleans(*left, *right),
(Boolean(left), Nothing) => CompareValues::Booleans(*left, false), (Boolean(left), Nothing) => CompareValues::Ints(if *left { 1 } else { 0 }, -1),
(Nothing, Boolean(right)) => CompareValues::Booleans(false, *right), (Nothing, Boolean(right)) => CompareValues::Ints(-1, if *right { 1 } else { 0 }),
(String(left), Nothing) => CompareValues::String(left.clone(), std::string::String::new()), (String(left), Nothing) => CompareValues::String(left.clone(), std::string::String::new()),
(Nothing, String(right)) => { (Nothing, String(right)) => {
CompareValues::String(std::string::String::new(), right.clone()) CompareValues::String(std::string::String::new(), right.clone())

View File

@ -4,25 +4,25 @@ description = "Core commands for nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-engine" name = "nu-engine"
version = "0.40.0" version = "0.42.0"
[dependencies] [dependencies]
nu-data = { version = "0.40.0", path="../nu-data" } nu-data = { version = "0.42.0", path="../nu-data" }
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-parser = { version = "0.40.0", path="../nu-parser" } nu-parser = { version = "0.42.0", path="../nu-parser" }
nu-plugin = { version = "0.40.0", path="../nu-plugin" } nu-plugin = { version = "0.42.0", path="../nu-plugin" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-stream = { version = "0.40.0", path="../nu-stream" } nu-stream = { version = "0.42.0", path="../nu-stream" }
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" } nu-value-ext = { version = "0.42.0", path="../nu-value-ext" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
trash = { version="1.3.0", optional=true } trash = { version = "2.0.2", optional = true }
which = { version="4.0.2", optional=true } which = { version="4.0.2", optional=true }
codespan-reporting = "0.11.0" codespan-reporting = "0.11.0"
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
bytes = "1.1.0" bytes = "1.1.0"
chrono = { version="0.4.19", features=["serde"] } chrono = { version="0.4.19", features=["serde"] }
derive-new = "0.5.8" derive-new = "0.5.8"
@ -36,7 +36,7 @@ indexmap = { version="1.6.1", features=["serde-1"] }
itertools = "0.10.0" itertools = "0.10.0"
lazy_static = "1.*" lazy_static = "1.*"
log = "0.4.14" log = "0.4.14"
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
parking_lot = "0.11.1" parking_lot = "0.11.1"
rayon = "1.5.0" rayon = "1.5.0"
serde = { version="1.0.123", features=["derive"] } serde = { version="1.0.123", features=["derive"] }
@ -50,7 +50,7 @@ umask = "1.0.0"
users = "0.11.0" users = "0.11.0"
[dev-dependencies] [dev-dependencies]
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
hamcrest2 = "0.3.0" hamcrest2 = "0.3.0"
[features] [features]

View File

@ -1,5 +1,7 @@
# Nu-Engine # Nu-Engine
Nu-engine handles most of the core logic of nushell. For example, engine handles: Nu-engine handles most of the core logic of nushell. For example, engine handles:
- Passing of data between commands - Passing of data between commands
- Evaluating a commands return values - Evaluating a commands return values
- Loading of user configurations - Loading of user configurations

View File

@ -8,22 +8,13 @@ use std::collections::HashMap;
const COMMANDS_DOCS_DIR: &str = "docs/commands"; const COMMANDS_DOCS_DIR: &str = "docs/commands";
#[derive(Default)]
pub struct DocumentationConfig { pub struct DocumentationConfig {
no_subcommands: bool, no_subcommands: bool,
no_color: bool, no_color: bool,
brief: bool, brief: bool,
} }
impl Default for DocumentationConfig {
fn default() -> Self {
DocumentationConfig {
no_subcommands: false,
no_color: false,
brief: false,
}
}
}
fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> { fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> {
let mut row_entries = IndexMap::new(); let mut row_entries = IndexMap::new();
let command = scope let command = scope

View File

@ -60,7 +60,7 @@ pub fn nu(scope: &Scope, ctx: &EvaluationContext) -> Result<Value, ShellError> {
// std::env::vars(), rather than the case-sensitive Environment.GetEnvironmentVariables() of .NET that PowerShell // std::env::vars(), rather than the case-sensitive Environment.GetEnvironmentVariables() of .NET that PowerShell
// uses. // uses.
// //
// For now, we work around the discrepency as best we can by merging the two into what is shown to the user as the // For now, we work around the discrepancy as best we can by merging the two into what is shown to the user as the
// 'path' column of `$nu` // 'path' column of `$nu`
let mut table = vec![]; let mut table = vec![];
for v in env { for v in env {

View File

@ -884,7 +884,7 @@ impl Shell for FilesystemShell {
) -> Result<OutputStream, ShellError> { ) -> Result<OutputStream, ShellError> {
let mut options = OpenOptions::new(); let mut options = OpenOptions::new();
if append { if append {
options.append(true) options.append(true).create(true)
} else { } else {
options.write(true).create(true).truncate(true) options.write(true).create(true).truncate(true)
}; };

View File

@ -34,7 +34,7 @@ impl FileStructure {
self.resources self.resources
.iter() .iter()
.map(|f| (PathBuf::from(&f.loc), f.at)) .map(|f| (PathBuf::from(&f.loc), f.at))
.map(|f| to(f)) .map(to)
.collect() .collect()
} }

View File

@ -238,7 +238,7 @@ impl Default for Theme {
variable: ThemeColor(Color::Purple), variable: ThemeColor(Color::Purple),
whitespace: ThemeColor(Color::White), whitespace: ThemeColor(Color::White),
word: ThemeColor(Color::Green), word: ThemeColor(Color::Green),
// These should really be Syles and not colors // These should really be Styles and not colors
// leave this here for the next change to make // leave this here for the next change to make
// ThemeColor, ThemeStyle. // ThemeColor, ThemeStyle.
// open_delimiter: ThemeColor(Color::White.normal()), // open_delimiter: ThemeColor(Color::White.normal()),

View File

@ -597,7 +597,7 @@ impl VarSyntaxShapeDeductor {
} }
Expression::Table(header, _rows) => { Expression::Table(header, _rows) => {
self.infer_shapes_in_table_header(header)?; self.infer_shapes_in_table_header(header)?;
// Shapes within columns can be heterogenous as long as // Shapes within columns can be heterogeneous as long as
// https://github.com/nushell/rfcs/pull/3 // https://github.com/nushell/rfcs/pull/3
// didn't land // didn't land
// self.infer_shapes_in_rows(_rows)?; // self.infer_shapes_in_rows(_rows)?;

View File

@ -34,3 +34,21 @@ fn compare_to_nothing() {
); );
assert_eq!(actual.out, "true"); assert_eq!(actual.out, "true");
} }
#[test]
fn compare_nothing_and_boolean() {
let actual = nu!(
cwd: ".",
r#"
if $true == $nothing {echo $true} {echo $false}
"#
);
assert_eq!(actual.out, "false");
let actual = nu!(
cwd: ".",
r#"
if $false == $nothing {echo $true} {echo $false}
"#
);
assert_eq!(actual.out, "false");
}

View File

@ -4,20 +4,20 @@ description = "Core error subsystem for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-errors" name = "nu-errors"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
codespan-reporting = { version="0.11.0", features=["serialization"] } codespan-reporting = { version="0.11.0", features=["serialization"] }
derive-new = "0.5.8" derive-new = "0.5.8"
getset = "0.1.1" getset = "0.1.1"
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
num-traits = "0.2.14" num-traits = "0.2.14"
serde = { version="1.0.123", features=["derive"] } serde = { version="1.0.123", features=["derive"] }

View File

@ -4,7 +4,7 @@ description = "Fork of serde-hjson"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-json" name = "nu-json"
version = "0.40.0" version = "0.42.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -20,6 +20,6 @@ lazy_static = "1"
linked-hash-map = { version="0.5", optional=true } linked-hash-map = { version="0.5", optional=true }
[dev-dependencies] [dev-dependencies]
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
serde_json = "1.0.39" serde_json = "1.0.39"

View File

@ -925,11 +925,8 @@ fn escape_char<W>(wr: &mut W, value: char) -> Result<()>
where where
W: io::Write, W: io::Write,
{ {
// FIXME: this allocation is required in order to be compatible with stable let mut scratch = [0_u8; 4];
// rust, which doesn't support encoding a `char` into a stack buffer. escape_bytes(wr, value.encode_utf8(&mut scratch).as_bytes())
let mut s = String::new();
s.push(value);
escape_bytes(wr, s.as_bytes())
} }
fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> Result<()> fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> Result<()>

View File

@ -4,23 +4,23 @@ description = "Nushell parser"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-parser" name = "nu-parser"
version = "0.40.0" version = "0.42.0"
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
derive-new = "0.5.8" derive-new = "0.5.8"
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
log = "0.4" log = "0.4"
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
itertools = "0.10.0" itertools = "0.10.0"
smart-default = "0.6.0" smart-default = "0.6.0"
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-data = { version = "0.40.0", path="../nu-data" } nu-data = { version = "0.42.0", path="../nu-data" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
nu-test-support = { version = "0.40.0", path="../nu-test-support" } nu-test-support = { version = "0.42.0", path="../nu-test-support" }
[features] [features]
stable = [] stable = []

View File

@ -132,7 +132,7 @@ mod tests {
match spec { match spec {
NamedType::Optional(_, _) => {} NamedType::Optional(_, _) => {}
_ => panic!("optional flag didn't parse succesfully"), _ => panic!("optional flag didn't parse successfully"),
} }
} }
} }

View File

@ -901,7 +901,7 @@ fn parse_arg(
return parse_dollar_expr(lite_arg, scope); return parse_dollar_expr(lite_arg, scope);
} }
// before anything else, try to see if this is a number in paranthesis // before anything else, try to see if this is a number in parenthesis
if lite_arg.item.starts_with('(') { if lite_arg.item.starts_with('(') {
return parse_full_column_path(lite_arg, scope); return parse_full_column_path(lite_arg, scope);
} }

View File

@ -4,7 +4,7 @@ description = "Path handling library for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-path" name = "nu-path"
version = "0.40.0" version = "0.42.0"
[dependencies] [dependencies]
dirs-next = "2.0.0" dirs-next = "2.0.0"

View File

@ -19,7 +19,7 @@ fn handle_dots_push(string: &mut String, count: u8) {
string.pop(); // remove last '/' string.pop(); // remove last '/'
} }
/// Expands any occurence of more than two dots into a sequence of ../ (or ..\ on windows), e.g., /// Expands any occurrence of more than two dots into a sequence of ../ (or ..\ on windows), e.g.,
/// "..." into "../..", "...." into "../../../", etc. /// "..." into "../..", "...." into "../../../", etc.
pub fn expand_ndots(path: impl AsRef<Path>) -> PathBuf { pub fn expand_ndots(path: impl AsRef<Path>) -> PathBuf {
// Check if path is valid UTF-8 and if not, return it as it is to avoid breaking it via string // Check if path is valid UTF-8 and if not, return it as it is to avoid breaking it via string

View File

@ -4,17 +4,17 @@ description = "Nushell Plugin"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-plugin" name = "nu-plugin"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
nu-test-support = { path="../nu-test-support", version = "0.40.0" } nu-test-support = { path="../nu-test-support", version = "0.42.0" }
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" } nu-value-ext = { path="../nu-value-ext", version = "0.42.0" }
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
serde = { version="1.0", features=["derive"] } serde = { version="1.0", features=["derive"] }
serde_json = "1.0" serde_json = "1.0"

View File

@ -4,7 +4,7 @@ description = "Pretty hex dump of bytes slice in the common style."
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-pretty-hex" name = "nu-pretty-hex"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
@ -16,7 +16,7 @@ name = "nu_pretty_hex"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
nu-ansi-term = { path="../nu-ansi-term", version = "0.40.0" } nu-ansi-term = { path="../nu-ansi-term", version = "0.42.0" }
rand = "0.8.3" rand = "0.8.3"
[dev-dependencies] [dev-dependencies]

View File

@ -4,13 +4,13 @@ description = "Core values and protocols for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-protocol" name = "nu-protocol"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
byte-unit = "4.0.9" byte-unit = "4.0.9"
chrono = { version="0.4.19", features=["serde"] } chrono = { version="0.4.19", features=["serde"] }
chrono-humanize = "0.2.1" chrono-humanize = "0.2.1"
@ -18,9 +18,9 @@ derive-new = "0.5.8"
getset = "0.1.1" getset = "0.1.1"
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
log = "0.4.14" log = "0.4.14"
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version = "0.4.3", features = ["serde"] }
num-integer = "0.1.44" num-integer = "0.1.44"
num-traits = "0.2.14" num-traits = "0.2.14"
serde = { version="1.0", features=["derive"] } serde = { version="1.0", features=["derive"] }
@ -29,7 +29,8 @@ serde_bytes = "0.11.5"
[dependencies.polars] [dependencies.polars]
version = "0.17.0" version = "0.17.0"
optional = true optional = true
features = ["default", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-date", "dtype-datetime", "dtype-time"] default-features = false
features = ["docs", "zip_with", "csv-file", "temporal", "performant", "pretty_fmt", "dtype-slim", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-date", "dtype-datetime", "dtype-time"]
[features] [features]
dataframe = ["polars"] dataframe = ["polars"]

View File

@ -6,7 +6,7 @@
macro_rules! out { macro_rules! out {
($($tokens:tt)*) => { ($($tokens:tt)*) => {
use std::io::Write; use std::io::Write;
print!($($tokens)*); write!(std::io::stdout(), $($tokens)*).unwrap_or(());
let _ = std::io::stdout().flush(); let _ = std::io::stdout().flush();
} }
} }
@ -17,7 +17,12 @@ macro_rules! out {
/// and stray printlns left by accident /// and stray printlns left by accident
#[macro_export] #[macro_export]
macro_rules! outln { macro_rules! outln {
($($tokens:tt)*) => { println!($($tokens)*) } ($($tokens:tt)*) => {
{
use std::io::Write;
writeln!(std::io::stdout(), $($tokens)*).unwrap_or(())
}
}
} }
/// Outputs to standard error /// Outputs to standard error
@ -26,7 +31,12 @@ macro_rules! outln {
/// and stray printlns left by accident /// and stray printlns left by accident
#[macro_export] #[macro_export]
macro_rules! errln { macro_rules! errln {
($($tokens:tt)*) => { eprintln!($($tokens)*) } ($($tokens:tt)*) => {
{
use std::io::Write;
writeln!(std::io::stderr(), $($tokens)*).unwrap_or(())
}
}
} }
#[macro_export] #[macro_export]

View File

@ -290,7 +290,7 @@ impl Primitive {
.expect("Internal error: conversion from u32 failed"), .expect("Internal error: conversion from u32 failed"),
); );
let secs = match secs.to_i64() { let secs = match secs.to_i64() {
//The duration crate doesnt accept seconds bigger than i64::MAX / 1000 //The duration crate doesn't accept seconds bigger than i64::MAX / 1000
Some(secs) => match secs.checked_mul(1000) { Some(secs) => match secs.checked_mul(1000) {
Some(_) => secs, Some(_) => secs,
None => { None => {

View File

@ -1,6 +1,6 @@
[package] [package]
name = "nu-serde" name = "nu-serde"
version = "0.40.0" version = "0.42.0"
edition = "2018" edition = "2018"
authors = ["The Nu Project Contributors"] authors = ["The Nu Project Contributors"]
description = "Turn any value into a nu-protocol::Value with serde" description = "Turn any value into a nu-protocol::Value with serde"
@ -9,9 +9,9 @@ repository = "https://github.com/nushell/nushell"
documentation = "https://docs.rs/nu-serde" documentation = "https://docs.rs/nu-serde"
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
nu-protocol = { version = "0.40.0", path = "../nu-protocol" } nu-protocol = { version = "0.42.0", path = "../nu-protocol" }
nu-source = { version = "0.40.0", path = "../nu-source" } nu-source = { version = "0.42.0", path = "../nu-source" }
serde = "1" serde = "1"
thiserror = "1" thiserror = "1"

View File

@ -4,7 +4,7 @@ description = "A source string characterizer for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-source" name = "nu-source"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false

View File

@ -4,12 +4,12 @@ description = "Nushell stream"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-stream" name = "nu-stream"
version = "0.40.0" version = "0.42.0"
[dependencies] [dependencies]
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
[features] [features]
stable = [] stable = []

View File

@ -4,7 +4,7 @@ description = "Nushell table printing"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-table" name = "nu-table"
version = "0.40.0" version = "0.42.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]] [[bin]]
@ -13,7 +13,7 @@ path = "src/main.rs"
[dependencies] [dependencies]
atty = "0.2.14" atty = "0.2.14"
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
regex = "1.4" regex = "1.4"
strip-ansi-escapes = "0.1.1" strip-ansi-escapes = "0.1.1"

View File

@ -4,22 +4,22 @@ description = "Support for writing Nushell tests"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-test-support" name = "nu-test-support"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-path = { version = "0.40.0", path="../nu-path" } nu-path = { version = "0.42.0", path="../nu-path" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
chrono = "0.4.19" chrono = "0.4.19"
getset = "0.1.1" getset = "0.1.1"
glob = "0.3.0" glob = "0.3.0"
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
num-bigint = { version="0.3.1", features=["serde"] } num-bigint = { version="0.4.3", features=["serde"] }
tempfile = "3.2.0" tempfile = "3.2.0"
hamcrest2 = "0.3.0" hamcrest2 = "0.3.0"

View File

@ -33,7 +33,7 @@ pub struct NuError {
pub output: Option<Outcome>, pub output: Option<Outcome>,
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug, Default)]
pub struct NuProcess { pub struct NuProcess {
pub arguments: Vec<OsString>, pub arguments: Vec<OsString>,
pub environment_vars: Vec<EnvironmentVariable>, pub environment_vars: Vec<EnvironmentVariable>,
@ -52,16 +52,6 @@ impl fmt::Display for NuProcess {
} }
} }
impl Default for NuProcess {
fn default() -> Self {
Self {
arguments: vec![],
environment_vars: Vec::default(),
cwd: None,
}
}
}
impl NuProcess { impl NuProcess {
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut Self { pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut Self {
self.arguments.push(arg.as_ref().to_os_string()); self.arguments.push(arg.as_ref().to_os_string());

View File

@ -4,15 +4,15 @@ description = "Extension traits for values in Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu-value-ext" name = "nu-value-ext"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
itertools = "0.10.0" itertools = "0.10.0"

View File

@ -4,7 +4,7 @@ description = "A binary viewer plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_binaryview" name = "nu_plugin_binaryview"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
@ -13,12 +13,12 @@ doctest = false
crossterm = "0.19" crossterm = "0.19"
image = { version = "0.23.14", default_features = false, features = ["png", "jpeg"] } image = { version = "0.23.14", default_features = false, features = ["png", "jpeg"] }
neso = "0.5.0" neso = "0.5.0"
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" } nu-ansi-term = { version = "0.42.0", path="../nu-ansi-term" }
nu-pretty-hex = { version = "0.40.0", path="../nu-pretty-hex" } nu-pretty-hex = { version = "0.42.0", path="../nu-pretty-hex" }
rawkey = "0.1.3" rawkey = "0.1.3"
[build-dependencies] [build-dependencies]

View File

@ -4,18 +4,18 @@ description = "A plugin to display charts"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_chart" name = "nu_plugin_chart"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-data = { path="../nu-data", version = "0.40.0" } nu-data = { path="../nu-data", version = "0.42.0" }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" } nu-value-ext = { path="../nu-value-ext", version = "0.42.0" }
crossterm = "0.19.0" crossterm = "0.19.0"
tui = { version="0.15.0", default-features=false, features=["crossterm"] } tui = { version="0.15.0", default-features=false, features=["crossterm"] }

View File

@ -20,8 +20,7 @@ const DEFAULT_LINE_COLORS: [Color; 5] = [
]; ];
#[derive(Debug)] #[derive(Debug)]
pub struct Line<'a> { pub struct Line {
title: &'a str,
x_labels: Vec<String>, x_labels: Vec<String>,
x_range: [f64; 2], x_range: [f64; 2],
y_range: [f64; 2], y_range: [f64; 2],
@ -29,10 +28,9 @@ pub struct Line<'a> {
data: Vec<Vec<(f64, f64)>>, data: Vec<Vec<(f64, f64)>>,
} }
impl<'a> Line<'a> { impl<'a> Line {
pub fn from_model(model: &'a Model) -> Result<Line<'a>, ShellError> { pub fn from_model(model: &'a Model) -> Result<Line, ShellError> {
Ok(Line { Ok(Line {
title: "Line Chart",
x_labels: model.labels.x.to_vec(), x_labels: model.labels.x.to_vec(),
x_range: [ x_range: [
model.ranges.0.start.as_u64()? as f64, model.ranges.0.start.as_u64()? as f64,

View File

@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_from_bson" name = "nu_plugin_from_bson"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
bson = { version = "2.0.1", features = [ "chrono-0_4" ] } bson = { version = "2.0.1", features = [ "chrono-0_4" ] }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
[build-dependencies] [build-dependencies]

View File

@ -4,16 +4,16 @@ description = "A converter plugin to the mp4 format for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_from_mp4" name = "nu_plugin_from_mp4"
version = "0.1.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
tempfile = "3.2.0" tempfile = "3.2.0"
mp4 = "0.9.0" mp4 = "0.9.0"

View File

@ -4,21 +4,21 @@ description = "A converter plugin to the bson format for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_from_sqlite" name = "nu_plugin_from_sqlite"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
tempfile = "3.2.0" tempfile = "3.2.0"
[dependencies.rusqlite] [dependencies.rusqlite]
features = ["bundled", "blob"] features = ["bundled", "blob"]
version = "0.25.3" version = "0.26.1"
[build-dependencies] [build-dependencies]

View File

@ -61,7 +61,7 @@ pub fn convert_sqlite_file_to_nu_value(
fn convert_sqlite_row_to_nu_value(row: &Row, tag: impl Into<Tag> + Clone) -> Value { fn convert_sqlite_row_to_nu_value(row: &Row, tag: impl Into<Tag> + Clone) -> Value {
let mut collected = TaggedDictBuilder::new(tag.clone()); let mut collected = TaggedDictBuilder::new(tag.clone());
for (i, c) in row.column_names().iter().enumerate() { for (i, c) in row.as_ref().column_names().iter().enumerate() {
collected.insert_value( collected.insert_value(
c.to_string(), c.to_string(),
convert_sqlite_value_to_nu_value(row.get_ref_unwrap(i), tag.clone()), convert_sqlite_value_to_nu_value(row.get_ref_unwrap(i), tag.clone()),

View File

@ -4,18 +4,18 @@ description = "A version incrementer plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_inc" name = "nu_plugin_inc"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
nu-test-support = { path="../nu-test-support", version = "0.40.0" } nu-test-support = { path="../nu-test-support", version = "0.42.0" }
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" } nu-value-ext = { path="../nu-value-ext", version = "0.42.0" }
semver = "0.11.0" semver = "0.11.0"

View File

@ -4,15 +4,15 @@ description = "A regex match plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_match" name = "nu_plugin_match"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
regex = "1.4.3" regex = "1.4.3"
[build-dependencies] [build-dependencies]

View File

@ -4,14 +4,14 @@ description = "query json files with gjson"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_query_json" name = "nu_plugin_query_json"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
gjson = "0.7.1" gjson = "0.8.0"
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-plugin = { version = "0.40.0", path="../nu-plugin" } nu-plugin = { version = "0.42.0", path="../nu-plugin" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }

View File

@ -4,17 +4,17 @@ description = "An S3 plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_s3" name = "nu_plugin_s3"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
futures = { version="0.3.12", features=["compat", "io-compat"] } futures = { version="0.3.12", features=["compat", "io-compat"] }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
s3handler = "0.7" s3handler = "0.7.5"
[build-dependencies] [build-dependencies]

View File

@ -4,17 +4,17 @@ description = "web scraping using css selector"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_selector" name = "nu_plugin_selector"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
scraper = "0.12.0" scraper = "0.12.0"
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-plugin = { version = "0.40.0", path="../nu-plugin" } nu-plugin = { version = "0.42.0", path="../nu-plugin" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
[dev-dependencies] [dev-dependencies]
indexmap = { version="1.7", features=["serde-1"] } indexmap = { version="1.7", features=["serde-1"] }

View File

@ -208,7 +208,7 @@ pub fn css(selector: &str) -> ScraperSelector {
mod tests { mod tests {
use super::*; use super::*;
const SIMPLE_LIST: &'static str = r#" const SIMPLE_LIST: &str = r#"
<ul> <ul>
<li>Coffee</li> <li>Coffee</li>
<li>Tea</li> <li>Tea</li>

View File

@ -4,17 +4,17 @@ description = "A plugin to open files/URLs directly from Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_start" name = "nu_plugin_start"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
glob = "0.3.0" glob = "0.3.0"
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
url = "2.2.0" url = "2.2.0"
webbrowser = "0.5.5" webbrowser = "0.5.5"
@ -22,5 +22,5 @@ webbrowser = "0.5.5"
open = "1.4.0" open = "1.4.0"
[build-dependencies] [build-dependencies]
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }

View File

@ -4,19 +4,19 @@ description = "Text viewer plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_textview" name = "nu_plugin_textview"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-data = { path="../nu-data", version = "0.40.0" } nu-data = { path="../nu-data", version = "0.42.0" }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
bat = { version="0.18", features=["regex-fancy", "paging", "git"] } bat = { version="0.18", default-features = false, features=["regex-onig", "paging", "git"] }
term_size = "0.3.2" term_size = "0.3.2"
url = "2.2.0" url = "2.2.0"

View File

@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_to_bson" name = "nu_plugin_to_bson"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
bson = { version = "2.0.1", features = [ "chrono-0_4" ] } bson = { version = "2.0.1", features = [ "chrono-0_4" ] }
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
num-traits = "0.2.14" num-traits = "0.2.14"
[features] [features]

View File

@ -61,7 +61,7 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
UntaggedValue::Primitive(Primitive::FilePath(s)) => Bson::String(s.display().to_string()), UntaggedValue::Primitive(Primitive::FilePath(s)) => Bson::String(s.display().to_string()),
UntaggedValue::Table(l) => Bson::Array( UntaggedValue::Table(l) => Bson::Array(
l.iter() l.iter()
.map(|x| value_to_bson_value(x)) .map(value_to_bson_value)
.collect::<Result<_, _>>()?, .collect::<Result<_, _>>()?,
), ),
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => Bson::Null, UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => Bson::Null,

View File

@ -4,21 +4,21 @@ description = "A converter plugin to the SQLite format for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_to_sqlite" name = "nu_plugin_to_sqlite"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
hex = "0.4.2" hex = "0.4.2"
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
nu-source = { path="../nu-source", version = "0.40.0" } nu-source = { path="../nu-source", version = "0.42.0" }
tempfile = "3.2.0" tempfile = "3.2.0"
[dependencies.rusqlite] [dependencies.rusqlite]
features = ["bundled", "blob"] features = ["bundled", "blob"]
version = "0.25.3" version = "0.26.1"
[build-dependencies] [build-dependencies]

View File

@ -4,17 +4,17 @@ description = "Tree viewer plugin for Nushell"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_tree" name = "nu_plugin_tree"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
derive-new = "0.5.8" derive-new = "0.5.8"
nu-errors = { path="../nu-errors", version = "0.40.0" } nu-errors = { path="../nu-errors", version = "0.42.0" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { path="../nu-protocol", version = "0.40.0" } nu-protocol = { path="../nu-protocol", version = "0.42.0" }
ptree = { version = "0.3.1", default-features = false } ptree = { version = "0.4.0", default-features = false }
[build-dependencies] [build-dependencies]

View File

@ -47,7 +47,7 @@ impl TreeView {
_ => value.clone(), _ => value.clone(),
}; };
builder = builder.begin_child(desc.clone()); builder = builder.begin_child(desc.clone());
Self::from_value_helper(&value, &mut builder); Self::from_value_helper(&value, builder);
builder = builder.end_child(); builder = builder.end_child();
//entries.push((desc.name.clone(), value.borrow().copy())) //entries.push((desc.name.clone(), value.borrow().copy()))
} }

View File

@ -4,21 +4,21 @@ description = "Traverses xml"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"
name = "nu_plugin_xpath" name = "nu_plugin_xpath"
version = "0.40.0" version = "0.42.0"
[lib] [lib]
doctest = false doctest = false
[dependencies] [dependencies]
nu-errors = { version = "0.40.0", path="../nu-errors" } nu-errors = { version = "0.42.0", path="../nu-errors" }
nu-plugin = { path="../nu-plugin", version = "0.40.0" } nu-plugin = { path="../nu-plugin", version = "0.42.0" }
nu-protocol = { version = "0.40.0", path="../nu-protocol" } nu-protocol = { version = "0.42.0", path="../nu-protocol" }
nu-source = { version = "0.40.0", path="../nu-source" } nu-source = { version = "0.42.0", path="../nu-source" }
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] } bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
indexmap = { version="1.6.1", features=["serde-1"] } indexmap = { version="1.6.1", features=["serde-1"] }
sxd-document = "0.3.2" sxd-document = "0.3.2"
sxd-xpath = "0.4.2" sxd-xpath = "0.4.2"
[dev-dependencies] [dev-dependencies]
nu-test-support = { path="../nu-test-support", version = "0.40.0" } nu-test-support = { path="../nu-test-support", version = "0.42.0" }

View File

@ -19,7 +19,7 @@ Kill a process using the process id.
## Examples ## Examples
Kill the pid using the most memory Kill the pid using the most memory
```shell ```shell
> ps | sort-by mem | last | kill $it.pid > ps | sort-by mem | last | each { kill $it.pid }
``` ```
Force kill a given pid Force kill a given pid

View File

@ -86,7 +86,7 @@ version = "0.4.6"
[dependencies.cursive] [dependencies.cursive]
default-features = false default-features = false
features = ["pancurses-backend"] features = ["pancurses-backend"]
version = "0.40.0" version = "0.42.0"
[dependencies.futures-preview] [dependencies.futures-preview]
features = ["compat", "io-compat"] features = ["compat", "io-compat"]

View File

@ -2,7 +2,7 @@
You may find it desirable to compile nu shell without requiring an OpenSSL installation on your system. You may find it desirable to compile nu shell without requiring an OpenSSL installation on your system.
You can do this by runnning: You can do this by running:
```sh ```sh
cargo build --no-default-features --features=rustyline-support cargo build --no-default-features --features=rustyline-support
``` ```

View File

@ -53,3 +53,20 @@ fn plugins_are_declared_with_wix() {
assert_eq!(actual.out, "0"); assert_eq!(actual.out, "0");
} }
#[test]
#[cfg(not(windows))]
fn do_not_panic_if_broken_pipe() {
// `nu -h | false`
// used to panic with a BrokenPipe error
let child_output = std::process::Command::new("sh")
.arg("-c")
.arg(format!(
"{:?} -h | false",
nu_test_support::fs::executable_path()
))
.output()
.expect("failed to execute process");
assert!(child_output.stderr.is_empty());
}

View File

@ -401,4 +401,48 @@ mod external_command_arguments {
}, },
) )
} }
#[cfg(not(windows))]
#[test]
fn semicolons_are_sanitized_before_passing_to_subshell() {
let actual = nu!(
cwd: ".",
"^echo \"a;b\""
);
assert_eq!(actual.out, "a;b");
}
#[cfg(not(windows))]
#[test]
fn ampersands_are_sanitized_before_passing_to_subshell() {
let actual = nu!(
cwd: ".",
"^echo \"a&b\""
);
assert_eq!(actual.out, "a&b");
}
#[cfg(not(windows))]
#[test]
fn subcommands_are_sanitized_before_passing_to_subshell() {
let actual = nu!(
cwd: ",",
"^echo \"$(ls)\""
);
assert_eq!(actual.out, "$(ls)");
}
#[cfg(not(windows))]
#[test]
fn shell_arguments_are_sanitized_even_if_coming_from_other_commands() {
let actual = nu!(
cwd: ",",
"^echo (echo \"a;&$(hello)\")"
);
assert_eq!(actual.out, "a;&$(hello)");
}
} }