mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
2590fcbe5c | |||
09691ff866 | |||
16db368232 | |||
df87d90b8c | |||
f2f01b8a4d | |||
6c0190cd38 | |||
b26246bf12 | |||
36a4effbb2 | |||
9fca417f8c | |||
d09e1148b2 | |||
493bc2b1c9 | |||
74b812228c | |||
649b3804c1 | |||
df6a53f52e | |||
c4af5df828 | |||
f94a3e15f5 | |||
75782f0f50 | |||
2b06ce27d3 | |||
72c241348b | |||
ab2d2db987 | |||
07e05ef183 | |||
a986de8ad0 | |||
22cfe4391e | |||
97d17311f4 | |||
0f6fd30619 |
118
.github/workflows/docker-publish.yml
vendored
118
.github/workflows/docker-publish.yml
vendored
@ -1,118 +0,0 @@
|
||||
name: Publish consumable Docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v?[0-9]+.[0-9]+.[0-9]+*']
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch:
|
||||
- x86_64-unknown-linux-musl
|
||||
- x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install rust-embedded/cross
|
||||
env: { VERSION: v0.1.16 }
|
||||
run: >-
|
||||
wget -nv https://github.com/rust-embedded/cross/releases/download/${VERSION}/cross-${VERSION}-x86_64-unknown-linux-gnu.tar.gz
|
||||
-O- | sudo tar xz -C /usr/local/bin/
|
||||
- name: compile for specific target
|
||||
env: { arch: '${{ matrix.arch }}' }
|
||||
run: |
|
||||
cross build --target ${{ matrix.arch }} --release
|
||||
# leave only the executable file
|
||||
rm -frd target/${{ matrix.arch }}/release/{*/*,*.d,*.rlib,.fingerprint}
|
||||
find . -empty -delete
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: ${{ matrix.arch }}
|
||||
path: target/${{ matrix.arch }}/release
|
||||
|
||||
docker:
|
||||
name: Build and publish docker images
|
||||
needs: compile
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_REGISTRY: quay.io/nushell
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY }}
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
||||
strategy:
|
||||
matrix:
|
||||
tag:
|
||||
- alpine
|
||||
- slim
|
||||
- debian
|
||||
- glibc-busybox
|
||||
- musl-busybox
|
||||
- musl-distroless
|
||||
- glibc-distroless
|
||||
- glibc
|
||||
- musl
|
||||
include:
|
||||
- { tag: alpine, base-image: alpine, arch: x86_64-unknown-linux-musl, plugin: true, use-patch: false}
|
||||
- { tag: slim, base-image: 'debian:stable-slim', arch: x86_64-unknown-linux-gnu, plugin: true, use-patch: false}
|
||||
- { tag: debian, base-image: debian, arch: x86_64-unknown-linux-gnu, plugin: true, use-patch: false}
|
||||
- { tag: glibc-busybox, base-image: 'busybox:glibc', arch: x86_64-unknown-linux-gnu, plugin: false, use-patch: true }
|
||||
- { tag: musl-busybox, base-image: 'busybox:musl', arch: x86_64-unknown-linux-musl, plugin: false, use-patch: false}
|
||||
- { tag: musl-distroless, base-image: 'gcr.io/distroless/static', arch: x86_64-unknown-linux-musl, plugin: false, use-patch: false}
|
||||
- { tag: glibc-distroless, base-image: 'gcr.io/distroless/cc', arch: x86_64-unknown-linux-gnu, plugin: false, use-patch: true }
|
||||
- { tag: glibc, base-image: scratch, arch: x86_64-unknown-linux-gnu, plugin: false, use-patch: false}
|
||||
- { tag: musl, base-image: scratch, arch: x86_64-unknown-linux-musl, plugin: false, use-patch: false}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@master
|
||||
with: { name: '${{ matrix.arch }}', path: target/release }
|
||||
- name: Build and publish exact version
|
||||
run: |-
|
||||
export DOCKER_TAG=${GITHUB_REF##*/}-${{ matrix.tag }}
|
||||
export NU_BINS=target/release/$( [ ${{ matrix.plugin }} = true ] && echo nu* || echo nu )
|
||||
export PATCH=$([ ${{ matrix.use-patch }} = true ] && echo .${{ matrix.tag }} || echo '')
|
||||
chmod +x $NU_BINS
|
||||
|
||||
echo ${DOCKER_PASSWORD} | docker login ${DOCKER_REGISTRY} -u ${DOCKER_USER} --password-stdin
|
||||
docker-compose --file docker/docker-compose.package.yml build
|
||||
docker-compose --file docker/docker-compose.package.yml push # exact version
|
||||
env:
|
||||
BASE_IMAGE: ${{ matrix.base-image }}
|
||||
|
||||
#region semantics tagging
|
||||
- name: Retag and push with suffixed version
|
||||
run: |-
|
||||
VERSION=${GITHUB_REF##*/}
|
||||
|
||||
latest_version=${VERSION%%%.*}-${{ matrix.tag }}
|
||||
latest_feature=${VERSION%%.*}-${{ matrix.tag }}
|
||||
latest_patch=${VERSION%.*}-${{ matrix.tag }}
|
||||
exact_version=${VERSION}-${{ matrix.tag }}
|
||||
|
||||
tags=( ${latest_version} ${latest_feature} ${latest_patch} ${exact_version} )
|
||||
|
||||
for tag in ${tags[@]}; do
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${tag}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${tag}
|
||||
done
|
||||
|
||||
# latest version
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${{ matrix.tag }}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${{ matrix.tag }}
|
||||
|
||||
- name: Retag and push debian as latest
|
||||
if: matrix.tag == 'debian'
|
||||
run: |-
|
||||
VERSION=${GITHUB_REF##*/}
|
||||
|
||||
# ${latest features} ${latest patch} ${exact version}
|
||||
tags=( ${VERSION%%.*} ${VERSION%.*} ${VERSION} )
|
||||
|
||||
for tag in ${tags[@]}; do
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${VERSION}-${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:${tag}
|
||||
docker push ${DOCKER_REGISTRY}/nu:${tag}
|
||||
done
|
||||
|
||||
# latest version
|
||||
docker tag ${DOCKER_REGISTRY}/nu:${{ matrix.tag }} ${DOCKER_REGISTRY}/nu:latest
|
||||
docker push ${DOCKER_REGISTRY}/nu:latest
|
||||
#endregion semantics tagging
|
271
.github/workflows/release.yml
vendored
271
.github/workflows/release.yml
vendored
@ -1,6 +1,7 @@
|
||||
name: Create Release Draft
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags: ['[0-9]+.[0-9]+.[0-9]+*']
|
||||
|
||||
@ -28,6 +29,96 @@ jobs:
|
||||
command: build
|
||||
args: --release --all --features=extra
|
||||
|
||||
- name: Compress binaries (nu)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu
|
||||
|
||||
- name: Compress binaries (nu_plugin_inc)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_inc
|
||||
|
||||
- name: Compress binaries (nu_plugin_match)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_match
|
||||
|
||||
- name: Compress binaries (nu_plugin_textview)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_textview
|
||||
|
||||
- name: Compress binaries (nu_plugin_binaryview)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_binaryview
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_bar)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_bar
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_line)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_line
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_bson)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_bson
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_sqlite)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_sqlite
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_mp4)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_mp4
|
||||
|
||||
- name: Compress binaries (nu_plugin_query_json)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_query_json
|
||||
|
||||
- name: Compress binaries (nu_plugin_s3)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_s3
|
||||
|
||||
- name: Compress binaries (nu_plugin_selector)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_selector
|
||||
|
||||
- name: Compress binaries (nu_plugin_start)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_start
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_bson)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_bson
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_sqlite)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_sqlite
|
||||
|
||||
- name: Compress binaries (nu_plugin_tree)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_tree
|
||||
|
||||
- name: Compress binaries (nu_plugin_xpath)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_xpath
|
||||
|
||||
- name: Create output directory
|
||||
run: mkdir output
|
||||
|
||||
@ -70,6 +161,96 @@ jobs:
|
||||
command: build
|
||||
args: --release --all --features=extra
|
||||
|
||||
- name: Compress binaries (nu)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu
|
||||
|
||||
- name: Compress binaries (nu_plugin_inc)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_inc
|
||||
|
||||
- name: Compress binaries (nu_plugin_match)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_match
|
||||
|
||||
- name: Compress binaries (nu_plugin_textview)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_textview
|
||||
|
||||
- name: Compress binaries (nu_plugin_binaryview)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_binaryview
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_bar)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_bar
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_line)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_line
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_bson)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_bson
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_sqlite)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_sqlite
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_mp4)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_mp4
|
||||
|
||||
- name: Compress binaries (nu_plugin_query_json)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_query_json
|
||||
|
||||
- name: Compress binaries (nu_plugin_s3)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_s3
|
||||
|
||||
- name: Compress binaries (nu_plugin_selector)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_selector
|
||||
|
||||
- name: Compress binaries (nu_plugin_start)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_start
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_bson)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_bson
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_sqlite)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_sqlite
|
||||
|
||||
- name: Compress binaries (nu_plugin_tree)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_tree
|
||||
|
||||
- name: Compress binaries (nu_plugin_xpath)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_xpath
|
||||
|
||||
- name: Create output directory
|
||||
run: mkdir output
|
||||
|
||||
@ -114,6 +295,96 @@ jobs:
|
||||
command: build
|
||||
args: --release --all --features=extra
|
||||
|
||||
- name: Compress binaries (nu.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_inc.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_inc.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_match.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_match.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_textview.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_textview.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_binaryview.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_binaryview.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_bar.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_bar.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_chart_line.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_chart_line.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_bson.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_bson.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_sqlite.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_sqlite.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_from_mp4.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_from_mp4.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_query_json.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_query_json.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_s3.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_s3.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_selector.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_selector.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_start.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_start.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_bson.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_bson.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_to_sqlite.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_to_sqlite.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_tree.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_tree.exe
|
||||
|
||||
- name: Compress binaries (nu_plugin_xpath.exe)
|
||||
uses: svenstaro/upx-action@v2
|
||||
with:
|
||||
file: target/release/nu_plugin_xpath.exe
|
||||
|
||||
- name: Create output directory
|
||||
run: mkdir output
|
||||
|
||||
|
11
.github/workflows/stale.yml
vendored
11
.github/workflows/stale.yml
vendored
@ -19,11 +19,10 @@ jobs:
|
||||
operations-per-run: 520
|
||||
enable-statistics: true
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is being marked stale because it has been open for 90 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active.'
|
||||
stale-pr-message: 'This PR is being marked stale because it has been open for 45 days without activity. If this PR is still active, please comment below and we will keep it marked as active.'
|
||||
close-issue-message: 'This issue has been marked stale for more than 10 days without activity. Closing this issue, but if you find that the issue is still valid, please reopen.'
|
||||
close-pr-message: 'This PR has been marked stale for more than 10 days without activity. Closing this PR, but if you are still working on it, please reopen.'
|
||||
close-issue-message: 'This issue has been marked stale for more than 100000 days without activity. Closing this issue, but if you find that the issue is still valid, please reopen.'
|
||||
close-pr-message: 'This PR has been marked stale for more than 100 days without activity. Closing this PR, but if you are still working on it, please reopen.'
|
||||
days-before-issue-stale: 90
|
||||
days-before-pr-stale: 45
|
||||
days-before-issue-close: 10
|
||||
days-before-pr-close: 10
|
||||
days-before-issue-close: 100000
|
||||
days-before-pr-close: 100
|
||||
exempt-issue-labels: 'exempt,keep'
|
||||
|
317
Cargo.lock
generated
317
Cargo.lock
generated
@ -109,7 +109,7 @@ checksum = "47044a1809e2953fe6d084312b81dcb7d9ffc24fee45aa39e5b938f66f75b8a8"
|
||||
dependencies = [
|
||||
"clipboard-win",
|
||||
"core-graphics",
|
||||
"image 0.23.14",
|
||||
"image",
|
||||
"log",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
@ -144,42 +144,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "arrow2"
|
||||
version = "0.5.3"
|
||||
name = "arrow-format"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd13b40184904cea33bbc7388c394a995ae5e74d21314c5084d6392753415510"
|
||||
checksum = "9f7da2d9660bfaebbdb0a44a33b3bd1dcb5a952fafa02c0dfc6a51ea471fef2a"
|
||||
dependencies = [
|
||||
"flatbuffers",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrow2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d873e2775c3d87a4e8d77aa544cbd43f34a0779d5164c59e7c6a1dd0678eb395"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"arrow-format",
|
||||
"base64",
|
||||
"chrono",
|
||||
"csv",
|
||||
"flatbuffers",
|
||||
"futures 0.3.16",
|
||||
"hash_hasher",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"lexical-core",
|
||||
"multiversion",
|
||||
"num-traits",
|
||||
"parquet2",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"simdutf8",
|
||||
"streaming-iterator",
|
||||
"strength_reduce",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "as-slice"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0"
|
||||
dependencies = [
|
||||
"generic-array 0.12.4",
|
||||
"generic-array 0.13.3",
|
||||
"generic-array 0.14.4",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
version = "0.3.2"
|
||||
@ -355,7 +352,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -381,21 +378,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bson"
|
||||
version = "0.14.1"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c177ed0122f24ce5e0f05bf9b29e79f3ac1a359bc504e0e14c3b34896c71c00"
|
||||
checksum = "ff58d466782b57e0001c8e97c6a70c01c2359d7e13e257a83654c0b783ecc139"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"ahash",
|
||||
"base64",
|
||||
"chrono",
|
||||
"decimal",
|
||||
"hex 0.3.2",
|
||||
"libc",
|
||||
"linked-hash-map",
|
||||
"md5 0.6.1",
|
||||
"rand 0.7.3",
|
||||
"hex",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"rand 0.8.4",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"time",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -800,7 +797,7 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
@ -879,27 +876,6 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
|
||||
|
||||
[[package]]
|
||||
name = "decimal"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a8ab77e91baeb15034c3be91e87bff4665c9036216148e4996d9a9f5792114d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deflate"
|
||||
version = "0.7.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deflate"
|
||||
version = "0.8.6"
|
||||
@ -940,7 +916,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1456,24 +1432,6 @@ version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
@ -1651,9 +1609,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.1.1"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc"
|
||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
@ -1685,13 +1643,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.6.1"
|
||||
version = "0.7.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "634bd4d29cbf24424d0a4bfcbf80c6960129dc24424752a7d1d1390607023422"
|
||||
checksum = "9c1ad878e07405df82b695089e63d278244344f80e764074d0bdfe99b89460f3"
|
||||
dependencies = [
|
||||
"as-slice",
|
||||
"generic-array 0.14.4",
|
||||
"hash32",
|
||||
"spin",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
@ -1704,12 +1661,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
@ -1855,20 +1806,6 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.22.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08ed2ada878397b045454ac7cfb011d73132c59f31a955d230bd1f1c2e68eb4a"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"jpeg-decoder",
|
||||
"num-iter",
|
||||
"num-rational 0.2.4",
|
||||
"num-traits",
|
||||
"png 0.15.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.23.14"
|
||||
@ -1878,10 +1815,11 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"jpeg-decoder",
|
||||
"num-iter",
|
||||
"num-rational 0.3.2",
|
||||
"num-traits",
|
||||
"png 0.16.8",
|
||||
"png",
|
||||
"tiff",
|
||||
]
|
||||
|
||||
@ -1896,15 +1834,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inflate"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.7.2"
|
||||
@ -2237,12 +2166,6 @@ dependencies = [
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "md5"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d"
|
||||
|
||||
[[package]]
|
||||
name = "md5"
|
||||
version = "0.7.0"
|
||||
@ -2257,9 +2180,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.2.3"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4"
|
||||
checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -2342,9 +2265,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mp4"
|
||||
version = "0.8.3"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51eb18a88129198ca1e8e92f26038ed6814cd0e608fa43215bf57368604bf093"
|
||||
checksum = "85660d4d88b9318d95396943adc4a254b3ed8bf1de917e6f093abda1ccf0bec0"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bytes 0.5.6",
|
||||
@ -2421,19 +2344,6 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nipper"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "761382864693f4bb171abf9e8de181a320b00464a83a9a5071059057b1fe0116"
|
||||
dependencies = [
|
||||
"cssparser",
|
||||
"html5ever",
|
||||
"markup5ever",
|
||||
"selectors",
|
||||
"tendril",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.20.1"
|
||||
@ -2483,7 +2393,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"ctrlc",
|
||||
"futures 0.3.16",
|
||||
@ -2523,7 +2433,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"doc-comment",
|
||||
"overload",
|
||||
@ -2535,7 +2445,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-cli"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"ctrlc",
|
||||
"indexmap",
|
||||
@ -2562,7 +2472,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-command"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"arboard",
|
||||
@ -2650,7 +2560,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-completion"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"is_executable",
|
||||
@ -2666,7 +2576,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-data"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"byte-unit",
|
||||
@ -2692,16 +2602,14 @@ dependencies = [
|
||||
"sha2",
|
||||
"sys-locale",
|
||||
"toml",
|
||||
"users",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-engine"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"bigdecimal-rs",
|
||||
"bytes 0.5.6",
|
||||
"bytes 1.1.0",
|
||||
"chrono",
|
||||
"codespan-reporting",
|
||||
"derive-new",
|
||||
@ -2743,7 +2651,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-errors"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"codespan-reporting",
|
||||
@ -2762,7 +2670,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-json"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"linked-hash-map",
|
||||
@ -2776,7 +2684,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-parser"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"derive-new",
|
||||
@ -2795,7 +2703,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-path"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"dirs-next",
|
||||
"dunce",
|
||||
@ -2803,7 +2711,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-plugin"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"nu-errors",
|
||||
@ -2817,7 +2725,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-pretty-hex"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"nu-ansi-term",
|
||||
@ -2826,7 +2734,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-protocol"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"byte-unit",
|
||||
@ -2848,7 +2756,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-serde"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"insta",
|
||||
@ -2860,7 +2768,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-source"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"derive-new",
|
||||
"getset",
|
||||
@ -2871,7 +2779,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-stream"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"nu-errors",
|
||||
"nu-protocol",
|
||||
@ -2880,7 +2788,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-table"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"nu-ansi-term",
|
||||
@ -2891,7 +2799,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-test-support"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"chrono",
|
||||
@ -2909,7 +2817,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu-value-ext"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itertools",
|
||||
@ -2921,10 +2829,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_binaryview"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"crossterm",
|
||||
"image 0.22.5",
|
||||
"image",
|
||||
"neso",
|
||||
"nu-ansi-term",
|
||||
"nu-errors",
|
||||
@ -2937,7 +2845,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_chart"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"crossterm",
|
||||
"nu-data",
|
||||
@ -2951,7 +2859,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_from_bson"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"bson",
|
||||
@ -2975,7 +2883,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_from_sqlite"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"nu-errors",
|
||||
@ -2988,7 +2896,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_inc"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"nu-errors",
|
||||
"nu-plugin",
|
||||
@ -3001,7 +2909,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_match"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"nu-errors",
|
||||
"nu-plugin",
|
||||
@ -3011,7 +2919,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_query_json"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"gjson",
|
||||
"nu-errors",
|
||||
@ -3022,7 +2930,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_s3"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"futures 0.3.16",
|
||||
"nu-errors",
|
||||
@ -3034,10 +2942,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_selector"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"nipper",
|
||||
"nu-errors",
|
||||
"nu-plugin",
|
||||
"nu-protocol",
|
||||
@ -3047,7 +2954,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_start"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"nu-errors",
|
||||
@ -3061,7 +2968,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_textview"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bat",
|
||||
"nu-data",
|
||||
@ -3075,7 +2982,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_to_bson"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bson",
|
||||
"nu-errors",
|
||||
@ -3087,9 +2994,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_to_sqlite"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"hex 0.4.3",
|
||||
"hex",
|
||||
"nu-errors",
|
||||
"nu-plugin",
|
||||
"nu-protocol",
|
||||
@ -3100,7 +3007,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_tree"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"derive-new",
|
||||
"nu-errors",
|
||||
@ -3111,7 +3018,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nu_plugin_xpath"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
dependencies = [
|
||||
"bigdecimal-rs",
|
||||
"indexmap",
|
||||
@ -3464,9 +3371,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parquet2"
|
||||
version = "0.4.0"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73758f76c8c842dfd846dfbc6ee05779aff626908531fffc3305a30cbccc55e7"
|
||||
checksum = "db82df54cdd88931d29b850190915b9069bb93fba8e1aefc0d59d8ca81603d6d"
|
||||
dependencies = [
|
||||
"async-stream",
|
||||
"bitpacking",
|
||||
@ -3476,7 +3383,7 @@ dependencies = [
|
||||
"lz4",
|
||||
"parquet-format-async-temp",
|
||||
"snap",
|
||||
"streaming-iterator",
|
||||
"streaming-decompression",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
@ -3611,18 +3518,6 @@ dependencies = [
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.15.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef859a23054bbfee7811284275ae522f0434a3c8e7f4b74bd4a35ae7e1c4a283"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
"deflate 0.7.20",
|
||||
"inflate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.16.8"
|
||||
@ -3631,15 +3526,15 @@ checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
"deflate 0.8.6",
|
||||
"deflate",
|
||||
"miniz_oxide 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polars"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3545b707f5dc6ac936540da732dbeb51f7f3a1c52bba7561be75fba07c38ee8"
|
||||
checksum = "7c94a25d46e93b64eac7848c028a545dc08fa01e148e4942c5442b3843c3a598"
|
||||
dependencies = [
|
||||
"polars-core",
|
||||
"polars-io",
|
||||
@ -3648,9 +3543,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "polars-arrow"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bebe1310113f2330e92faf7c67634b69a3c30fede04fe5236a258afb43d9d5f"
|
||||
checksum = "1cc4488d2f2d6b901bb6e5728e58966013a272cae48861070b676215a79b4a99"
|
||||
dependencies = [
|
||||
"arrow2",
|
||||
"num 0.4.0",
|
||||
@ -3659,9 +3554,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "polars-core"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8da53d641dcaebe2a3b6cc442f657fd83709cb22a67677eabeb24cb004ebd04e"
|
||||
checksum = "6771524063d742a08163d96875ca5df71dff7113f27da58db5ec5fa164165bf6"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
@ -3686,9 +3581,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "polars-io"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "708e3bf4d8866e4c8a2defe36d7a5359d69e3884a9da0a9cc1f2e2eac194177b"
|
||||
checksum = "11a5f5f51525043ee7befd49e586e6919345237826a5f17b53956f8242100957"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
@ -3697,6 +3592,7 @@ dependencies = [
|
||||
"dirs 3.0.2",
|
||||
"lazy_static",
|
||||
"lexical",
|
||||
"memchr",
|
||||
"memmap2",
|
||||
"num 0.4.0",
|
||||
"num_cpus",
|
||||
@ -3704,13 +3600,14 @@ dependencies = [
|
||||
"polars-core",
|
||||
"rayon",
|
||||
"regex",
|
||||
"simdutf8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polars-lazy"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d1ffc1bb44a8ddd0607448f49027d69debe3f7243aad3b17f713780d0d47205"
|
||||
checksum = "da3ea647e2fa59d1bbbf90929c5d10ef6a9018aac256d1c6d0e8248211804b61"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"itertools",
|
||||
@ -4365,7 +4262,7 @@ dependencies = [
|
||||
"hmac",
|
||||
"hmac-sha1",
|
||||
"log",
|
||||
"md5 0.7.0",
|
||||
"md5",
|
||||
"mime_guess",
|
||||
"quick-xml 0.22.0",
|
||||
"regex",
|
||||
@ -4666,6 +4563,12 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simdutf8"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c970da16e7c682fa90a261cf0724dee241c9f7831635ecc4e988ae8f3b505559"
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "1.3.0"
|
||||
@ -4717,6 +4620,15 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
@ -4741,6 +4653,15 @@ version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a"
|
||||
|
||||
[[package]]
|
||||
name = "streaming-decompression"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bc687acd5dc742c4a7094f2927a8614a68e4743ef682e7a2f9f0f711656cc92"
|
||||
dependencies = [
|
||||
"fallible-streaming-iterator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "streaming-iterator"
|
||||
version = "0.1.5"
|
||||
|
58
Cargo.toml
58
Cargo.toml
@ -10,7 +10,7 @@ license = "MIT"
|
||||
name = "nu"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/nushell/nushell"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[workspace]
|
||||
members = ["crates/*/"]
|
||||
@ -18,34 +18,34 @@ members = ["crates/*/"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-cli = { version = "0.38.0", path="./crates/nu-cli", default-features=false }
|
||||
nu-command = { version = "0.38.0", path="./crates/nu-command" }
|
||||
nu-completion = { version = "0.38.0", path="./crates/nu-completion" }
|
||||
nu-data = { version = "0.38.0", path="./crates/nu-data" }
|
||||
nu-engine = { version = "0.38.0", path="./crates/nu-engine" }
|
||||
nu-errors = { version = "0.38.0", path="./crates/nu-errors" }
|
||||
nu-parser = { version = "0.38.0", path="./crates/nu-parser" }
|
||||
nu-path = { version = "0.38.0", path="./crates/nu-path" }
|
||||
nu-plugin = { version = "0.38.0", path="./crates/nu-plugin" }
|
||||
nu-protocol = { version = "0.38.0", path="./crates/nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="./crates/nu-source" }
|
||||
nu-value-ext = { version = "0.38.0", path="./crates/nu-value-ext" }
|
||||
nu-cli = { version = "0.40.0", path="./crates/nu-cli", default-features=false }
|
||||
nu-command = { version = "0.40.0", path="./crates/nu-command" }
|
||||
nu-completion = { version = "0.40.0", path="./crates/nu-completion" }
|
||||
nu-data = { version = "0.40.0", path="./crates/nu-data" }
|
||||
nu-engine = { version = "0.40.0", path="./crates/nu-engine" }
|
||||
nu-errors = { version = "0.40.0", path="./crates/nu-errors" }
|
||||
nu-parser = { version = "0.40.0", path="./crates/nu-parser" }
|
||||
nu-path = { version = "0.40.0", path="./crates/nu-path" }
|
||||
nu-plugin = { version = "0.40.0", path="./crates/nu-plugin" }
|
||||
nu-protocol = { version = "0.40.0", path="./crates/nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="./crates/nu-source" }
|
||||
nu-value-ext = { version = "0.40.0", path="./crates/nu-value-ext" }
|
||||
|
||||
nu_plugin_binaryview = { version = "0.38.0", path="./crates/nu_plugin_binaryview", optional=true }
|
||||
nu_plugin_chart = { version = "0.38.0", path="./crates/nu_plugin_chart", optional=true }
|
||||
nu_plugin_from_bson = { version = "0.38.0", path="./crates/nu_plugin_from_bson", optional=true }
|
||||
nu_plugin_from_sqlite = { version = "0.38.0", path="./crates/nu_plugin_from_sqlite", optional=true }
|
||||
nu_plugin_inc = { version = "0.38.0", path="./crates/nu_plugin_inc", optional=true }
|
||||
nu_plugin_match = { version = "0.38.0", path="./crates/nu_plugin_match", optional=true }
|
||||
nu_plugin_query_json = { version = "0.38.0", path="./crates/nu_plugin_query_json", optional=true }
|
||||
nu_plugin_s3 = { version = "0.38.0", path="./crates/nu_plugin_s3", optional=true }
|
||||
nu_plugin_selector = { version = "0.38.0", path="./crates/nu_plugin_selector", optional=true }
|
||||
nu_plugin_start = { version = "0.38.0", path="./crates/nu_plugin_start", optional=true }
|
||||
nu_plugin_textview = { version = "0.38.0", path="./crates/nu_plugin_textview", optional=true }
|
||||
nu_plugin_to_bson = { version = "0.38.0", path="./crates/nu_plugin_to_bson", optional=true }
|
||||
nu_plugin_to_sqlite = { version = "0.38.0", path="./crates/nu_plugin_to_sqlite", optional=true }
|
||||
nu_plugin_tree = { version = "0.38.0", path="./crates/nu_plugin_tree", optional=true }
|
||||
nu_plugin_xpath = { version = "0.38.0", path="./crates/nu_plugin_xpath", optional=true }
|
||||
nu_plugin_binaryview = { version = "0.40.0", path="./crates/nu_plugin_binaryview", optional=true }
|
||||
nu_plugin_chart = { version = "0.40.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_sqlite = { version = "0.40.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_match = { version = "0.40.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_s3 = { version = "0.40.0", path="./crates/nu_plugin_s3", optional=true }
|
||||
nu_plugin_selector = { version = "0.40.0", path="./crates/nu_plugin_selector", optional=true }
|
||||
nu_plugin_start = { version = "0.40.0", path="./crates/nu_plugin_start", optional=true }
|
||||
nu_plugin_textview = { version = "0.40.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_sqlite = { version = "0.40.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_xpath = { version = "0.40.0", path="./crates/nu_plugin_xpath", optional=true }
|
||||
|
||||
# Required to bootstrap the main binary
|
||||
ctrlc = { version="3.1.7", optional=true }
|
||||
@ -53,7 +53,7 @@ futures = { version="0.3.12", features=["compat", "io-compat"] }
|
||||
itertools = "0.10.0"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { version = "0.38.0", path="./crates/nu-test-support" }
|
||||
nu-test-support = { version = "0.40.0", path="./crates/nu-test-support" }
|
||||
serial_test = "0.5.1"
|
||||
hamcrest2 = "0.3.0"
|
||||
rstest = "0.10.0"
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 - 2021 Yehuda Katz, Jonathan Turner
|
||||
Copyright (c) 2019 - 2021 Nushell Project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -68,7 +68,7 @@ cargo install nu
|
||||
To install Nu via the [Windows Package Manager](https://aka.ms/winget-cli):
|
||||
|
||||
```shell
|
||||
winget install nu
|
||||
winget install nushell
|
||||
```
|
||||
|
||||
You can also build Nu yourself with all the bells and whistles (be sure to have installed the [dependencies](https://www.nushell.sh/book/installation.html#dependencies) for your platform), once you have checked out this repo with git:
|
||||
|
@ -9,7 +9,7 @@ description = "Library for ANSI terminal colors and styles (bold, underline)"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-ansi-term"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -613,7 +613,7 @@ mod serde_json_tests {
|
||||
let serialized = serde_json::to_string(&color).unwrap();
|
||||
let deserialized: Color = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
assert_eq!(color, &deserialized);
|
||||
assert_eq!(color, deserialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,24 +4,24 @@ description = "CLI for nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-cli"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-completion = { version = "0.38.0", path="../nu-completion" }
|
||||
nu-command = { version = "0.38.0", path="../nu-command" }
|
||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-completion = { version = "0.40.0", path="../nu-completion" }
|
||||
nu-command = { version = "0.40.0", path="../nu-command" }
|
||||
nu-data = { version = "0.40.0", path="../nu-data" }
|
||||
nu-engine = { version = "0.40.0", path="../nu-engine" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-parser = { version = "0.40.0", path="../nu-parser" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.40.0", path="../nu-stream" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
|
||||
indexmap ="1.6.1"
|
||||
log = "0.4.14"
|
||||
|
@ -372,7 +372,7 @@ pub fn cli(
|
||||
LineResult::ClearHistory => {
|
||||
if options.save_history {
|
||||
rl.clear_history();
|
||||
let _ = rl.append_history(&history_path);
|
||||
std::fs::remove_file(&history_path)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,28 +5,28 @@ description = "CLI for nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-command"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-json = { version = "0.38.0", path="../nu-json" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-serde = { version = "0.38.0", path="../nu-serde" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
||||
nu-table = { version = "0.38.0", path="../nu-table" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-pretty-hex = { version = "0.38.0", path="../nu-pretty-hex" }
|
||||
nu-data = { version = "0.40.0", path="../nu-data" }
|
||||
nu-engine = { version = "0.40.0", path="../nu-engine" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-json = { version = "0.40.0", path="../nu-json" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-parser = { version = "0.40.0", path="../nu-parser" }
|
||||
nu-plugin = { version = "0.40.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-serde = { version = "0.40.0", path="../nu-serde" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.40.0", path="../nu-stream" }
|
||||
nu-table = { version = "0.40.0", path="../nu-table" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
nu-pretty-hex = { version = "0.40.0", path="../nu-pretty-hex" }
|
||||
|
||||
url = "2.2.1"
|
||||
mime = "0.3.16"
|
||||
@ -89,7 +89,7 @@ zip = { version="0.5.9", optional=true }
|
||||
digest = "0.9.0"
|
||||
|
||||
[dependencies.polars]
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
optional = true
|
||||
features = ["parquet", "json", "random", "pivot", "strings", "is_in", "temporal", "cum_agg", "rolling_window"]
|
||||
|
||||
|
@ -38,7 +38,7 @@ impl WholeStreamCommand for SubCommand {
|
||||
},
|
||||
Example {
|
||||
description: "Set coloring options",
|
||||
example: "config set color_config [[header_align header_bold]; [left $true]]",
|
||||
example: "config set color_config [[header_align header_color]; [left white_bold]]",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
|
@ -121,7 +121,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let tail = df.as_ref().get_columns().iter().map(|col| {
|
||||
let count = col.len() as f64;
|
||||
|
||||
let sum = match col.sum_as_series().cast_with_dtype(&DataType::Float64) {
|
||||
let sum = match col.sum_as_series().cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
@ -144,7 +144,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let min = match col.min_as_series().cast_with_dtype(&DataType::Float64) {
|
||||
let min = match col.min_as_series().cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
@ -153,7 +153,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
};
|
||||
|
||||
let q_25 = match col.quantile_as_series(0.25) {
|
||||
Ok(ca) => match ca.cast_with_dtype(&DataType::Float64) {
|
||||
Ok(ca) => match ca.cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
@ -164,7 +164,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
};
|
||||
|
||||
let q_50 = match col.quantile_as_series(0.50) {
|
||||
Ok(ca) => match ca.cast_with_dtype(&DataType::Float64) {
|
||||
Ok(ca) => match ca.cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
@ -175,7 +175,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
};
|
||||
|
||||
let q_75 = match col.quantile_as_series(0.75) {
|
||||
Ok(ca) => match ca.cast_with_dtype(&DataType::Float64) {
|
||||
Ok(ca) => match ca.cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
@ -185,7 +185,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
Err(_) => None,
|
||||
};
|
||||
|
||||
let max = match col.max_as_series().cast_with_dtype(&DataType::Float64) {
|
||||
let max = match col.max_as_series().cast(&DataType::Float64) {
|
||||
Ok(ca) => match ca.get(0) {
|
||||
AnyValue::Float64(v) => Some(v),
|
||||
_ => None,
|
||||
|
@ -44,6 +44,12 @@ impl WholeStreamCommand for DataFrame {
|
||||
"type of join. Inner by default",
|
||||
Some('t'),
|
||||
)
|
||||
.named(
|
||||
"suffix",
|
||||
SyntaxShape::String,
|
||||
"suffix for the columns of the right dataframe",
|
||||
Some('s'),
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
@ -104,6 +110,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let r_df: Value = args.req(0)?;
|
||||
let l_col: Vec<Value> = args.req_named("left")?;
|
||||
let r_col: Vec<Value> = args.req_named("right")?;
|
||||
let r_suffix: Option<Tagged<String>> = args.get_flag("suffix")?;
|
||||
let join_type_op: Option<Tagged<String>> = args.get_flag("type")?;
|
||||
|
||||
let join_type = match join_type_op {
|
||||
@ -124,6 +131,8 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
},
|
||||
};
|
||||
|
||||
let suffix = r_suffix.map(|s| s.item);
|
||||
|
||||
let (l_col_string, l_col_span) = convert_columns(&l_col, &tag)?;
|
||||
let (r_col_string, r_col_span) = convert_columns(&r_col, &tag)?;
|
||||
|
||||
@ -142,7 +151,13 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
)?;
|
||||
|
||||
df.as_ref()
|
||||
.join(r_df.as_ref(), &l_col_string, &r_col_string, join_type)
|
||||
.join(
|
||||
r_df.as_ref(),
|
||||
&l_col_string,
|
||||
&r_col_string,
|
||||
join_type,
|
||||
suffix,
|
||||
)
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &l_col_span, None))
|
||||
}
|
||||
_ => Err(ShellError::labeled_error(
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.day().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.hour().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.minute().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.month().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.nanosecond().into_series();
|
||||
|
@ -56,7 +56,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.ordinal().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.second().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.week().into_series();
|
||||
|
@ -53,7 +53,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.weekday().into_series();
|
||||
|
@ -56,7 +56,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.year().into_series();
|
||||
|
@ -6,7 +6,7 @@ use nu_protocol::{
|
||||
Signature, SyntaxShape, UntaggedValue,
|
||||
};
|
||||
use nu_source::Tagged;
|
||||
use polars::prelude::DataType;
|
||||
use polars::prelude::{DataType, RollingOptions};
|
||||
|
||||
enum RollType {
|
||||
Min,
|
||||
@ -57,7 +57,6 @@ impl WholeStreamCommand for DataFrame {
|
||||
Signature::build("dataframe rolling")
|
||||
.required("type", SyntaxShape::String, "rolling operation")
|
||||
.required("window", SyntaxShape::Int, "Window size for rolling")
|
||||
.switch("ignore_nulls", "Ignore nulls in column", Some('i'))
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
@ -112,7 +111,6 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
let roll_type: Tagged<String> = args.req(0)?;
|
||||
let window_size: Tagged<i64> = args.req(1)?;
|
||||
let ignore_nulls = args.has_flag("ignore_nulls");
|
||||
|
||||
let (df, df_tag) = NuDataFrame::try_from_stream(&mut args.input, &tag.span)?;
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
@ -126,31 +124,17 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
}
|
||||
|
||||
let roll_type = RollType::from_str(&roll_type.item, &roll_type.tag.span)?;
|
||||
let rolling_opts = RollingOptions {
|
||||
window_size: window_size.item as usize,
|
||||
min_periods: window_size.item as usize,
|
||||
weights: None,
|
||||
center: false,
|
||||
};
|
||||
let res = match roll_type {
|
||||
RollType::Max => series.rolling_max(
|
||||
window_size.item as u32,
|
||||
None,
|
||||
ignore_nulls,
|
||||
window_size.item as u32,
|
||||
),
|
||||
RollType::Min => series.rolling_min(
|
||||
window_size.item as u32,
|
||||
None,
|
||||
ignore_nulls,
|
||||
window_size.item as u32,
|
||||
),
|
||||
RollType::Sum => series.rolling_sum(
|
||||
window_size.item as u32,
|
||||
None,
|
||||
ignore_nulls,
|
||||
window_size.item as u32,
|
||||
),
|
||||
RollType::Mean => series.rolling_mean(
|
||||
window_size.item as u32,
|
||||
None,
|
||||
ignore_nulls,
|
||||
window_size.item as u32,
|
||||
),
|
||||
RollType::Max => series.rolling_max(rolling_opts),
|
||||
RollType::Min => series.rolling_min(rolling_opts),
|
||||
RollType::Sum => series.rolling_sum(rolling_opts),
|
||||
RollType::Mean => series.rolling_mean(rolling_opts),
|
||||
};
|
||||
|
||||
let mut res = res.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
@ -78,7 +78,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let casted = match indices.dtype() {
|
||||
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => indices
|
||||
.as_ref()
|
||||
.cast_with_dtype(&DataType::UInt32)
|
||||
.cast(&DataType::UInt32)
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
||||
_ => Err(ShellError::labeled_error_with_secondary(
|
||||
"Incorrect type",
|
||||
|
@ -58,7 +58,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let series = df.as_series(&df_tag.span)?;
|
||||
|
||||
let casted = series
|
||||
.date64()
|
||||
.datetime()
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||
|
||||
let res = casted.strftime(&fmt.item).into_series();
|
||||
|
@ -92,7 +92,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let casted = match series.dtype() {
|
||||
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => series
|
||||
.as_ref()
|
||||
.cast_with_dtype(&DataType::UInt32)
|
||||
.cast(&DataType::UInt32)
|
||||
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
||||
_ => Err(ShellError::labeled_error_with_secondary(
|
||||
"Incorrect type",
|
||||
|
@ -73,9 +73,9 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let writer = CsvWriter::new(&mut file);
|
||||
|
||||
let writer = if no_header {
|
||||
writer.has_headers(false)
|
||||
writer.has_header(false)
|
||||
} else {
|
||||
writer.has_headers(true)
|
||||
writer.has_header(true)
|
||||
};
|
||||
|
||||
let writer = match delimiter {
|
||||
|
283
crates/nu-command/src/commands/strings/detect/columns.rs
Normal file
283
crates/nu-command/src/commands/strings/detect/columns.rs
Normal file
@ -0,0 +1,283 @@
|
||||
use std::{iter::Peekable, str::CharIndices};
|
||||
|
||||
use crate::prelude::*;
|
||||
use nu_engine::WholeStreamCommand;
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::{Signature, SyntaxShape, TaggedDictBuilder, UntaggedValue};
|
||||
use nu_source::Spanned;
|
||||
|
||||
type Input<'t> = Peekable<CharIndices<'t>>;
|
||||
|
||||
pub struct DetectColumns;
|
||||
|
||||
impl WholeStreamCommand for DetectColumns {
|
||||
fn name(&self) -> &str {
|
||||
"detect columns"
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("detect columns")
|
||||
.named(
|
||||
"skip",
|
||||
SyntaxShape::Int,
|
||||
"number of rows to skip before detecting",
|
||||
Some('s'),
|
||||
)
|
||||
.switch("no_headers", "don't detect headers", Some('n'))
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"splits contents across multiple columns via the separator."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
detect_columns(args)
|
||||
}
|
||||
}
|
||||
|
||||
fn detect_columns(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
let name_tag = args.name_tag();
|
||||
let num_rows_to_skip: Option<usize> = args.get_flag("skip")?;
|
||||
let noheader = args.has_flag("no_headers");
|
||||
let input = args.input.collect_string(name_tag.clone())?;
|
||||
|
||||
let input: Vec<_> = input
|
||||
.lines()
|
||||
.skip(num_rows_to_skip.unwrap_or_default())
|
||||
.map(|x| x.to_string())
|
||||
.collect();
|
||||
|
||||
let mut input = input.into_iter();
|
||||
let headers = input.next();
|
||||
|
||||
if let Some(orig_headers) = headers {
|
||||
let headers = find_columns(&orig_headers);
|
||||
|
||||
Ok((if noheader {
|
||||
vec![orig_headers].into_iter().chain(input)
|
||||
} else {
|
||||
vec![].into_iter().chain(input)
|
||||
})
|
||||
.map(move |x| {
|
||||
let row = find_columns(&x);
|
||||
|
||||
let mut dict = TaggedDictBuilder::new(name_tag.clone());
|
||||
|
||||
if headers.len() == row.len() && !noheader {
|
||||
for (header, val) in headers.iter().zip(row.iter()) {
|
||||
dict.insert_untagged(&header.item, UntaggedValue::string(&val.item));
|
||||
}
|
||||
} else {
|
||||
let mut pre_output = vec![];
|
||||
|
||||
// column counts don't line up, so see if we can figure out why
|
||||
for cell in row {
|
||||
for header in &headers {
|
||||
if cell.span.start() <= header.span.end()
|
||||
&& cell.span.end() > header.span.start()
|
||||
{
|
||||
pre_output
|
||||
.push((header.item.to_string(), UntaggedValue::string(&cell.item)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for header in &headers {
|
||||
let mut found = false;
|
||||
for pre_o in &pre_output {
|
||||
if pre_o.0 == header.item {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
pre_output.push((header.item.to_string(), UntaggedValue::nothing()));
|
||||
}
|
||||
}
|
||||
|
||||
if noheader {
|
||||
for header in headers.iter().enumerate() {
|
||||
for pre_o in &pre_output {
|
||||
if pre_o.0 == header.1.item {
|
||||
dict.insert_untagged(format!("Column{}", header.0), pre_o.1.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for header in &headers {
|
||||
for pre_o in &pre_output {
|
||||
if pre_o.0 == header.item {
|
||||
dict.insert_untagged(&header.item, pre_o.1.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dict.into_value()
|
||||
})
|
||||
.into_output_stream())
|
||||
} else {
|
||||
Ok(OutputStream::empty())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_columns(input: &str) -> Vec<Spanned<String>> {
|
||||
let mut chars = input.char_indices().peekable();
|
||||
let mut output = vec![];
|
||||
|
||||
while let Some((_, c)) = chars.peek() {
|
||||
if c.is_whitespace() {
|
||||
// If the next character is non-newline whitespace, skip it.
|
||||
|
||||
let _ = chars.next();
|
||||
} else {
|
||||
// Otherwise, try to consume an unclassified token.
|
||||
|
||||
let result = baseline(&mut chars);
|
||||
|
||||
output.push(result);
|
||||
}
|
||||
}
|
||||
|
||||
output
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum BlockKind {
|
||||
Paren,
|
||||
CurlyBracket,
|
||||
SquareBracket,
|
||||
}
|
||||
|
||||
fn baseline(src: &mut Input) -> Spanned<String> {
|
||||
let mut token_contents = String::new();
|
||||
|
||||
let start_offset = if let Some((pos, _)) = src.peek() {
|
||||
*pos
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
// This variable tracks the starting character of a string literal, so that
|
||||
// we remain inside the string literal lexer mode until we encounter the
|
||||
// closing quote.
|
||||
let mut quote_start: Option<char> = None;
|
||||
|
||||
// This Vec tracks paired delimiters
|
||||
let mut block_level: Vec<BlockKind> = vec![];
|
||||
|
||||
// A baseline token is terminated if it's not nested inside of a paired
|
||||
// delimiter and the next character is one of: `|`, `;`, `#` or any
|
||||
// whitespace.
|
||||
fn is_termination(block_level: &[BlockKind], c: char) -> bool {
|
||||
block_level.is_empty() && (c.is_whitespace())
|
||||
}
|
||||
|
||||
// The process of slurping up a baseline token repeats:
|
||||
//
|
||||
// - String literal, which begins with `'`, `"` or `\``, and continues until
|
||||
// the same character is encountered again.
|
||||
// - Delimiter pair, which begins with `[`, `(`, or `{`, and continues until
|
||||
// the matching closing delimiter is found, skipping comments and string
|
||||
// literals.
|
||||
// - When not nested inside of a delimiter pair, when a terminating
|
||||
// character (whitespace, `|`, `;` or `#`) is encountered, the baseline
|
||||
// token is done.
|
||||
// - Otherwise, accumulate the character into the current baseline token.
|
||||
while let Some((_, c)) = src.peek() {
|
||||
let c = *c;
|
||||
|
||||
if quote_start.is_some() {
|
||||
// If we encountered the closing quote character for the current
|
||||
// string, we're done with the current string.
|
||||
if Some(c) == quote_start {
|
||||
quote_start = None;
|
||||
}
|
||||
} else if c == '\n' {
|
||||
if is_termination(&block_level, c) {
|
||||
break;
|
||||
}
|
||||
} else if c == '\'' || c == '"' || c == '`' {
|
||||
// We encountered the opening quote of a string literal.
|
||||
quote_start = Some(c);
|
||||
} else if c == '[' {
|
||||
// We encountered an opening `[` delimiter.
|
||||
block_level.push(BlockKind::SquareBracket);
|
||||
} else if c == ']' {
|
||||
// We encountered a closing `]` delimiter. Pop off the opening `[`
|
||||
// delimiter.
|
||||
if let Some(BlockKind::SquareBracket) = block_level.last() {
|
||||
let _ = block_level.pop();
|
||||
}
|
||||
} else if c == '{' {
|
||||
// We encountered an opening `{` delimiter.
|
||||
block_level.push(BlockKind::CurlyBracket);
|
||||
} else if c == '}' {
|
||||
// We encountered a closing `}` delimiter. Pop off the opening `{`.
|
||||
if let Some(BlockKind::CurlyBracket) = block_level.last() {
|
||||
let _ = block_level.pop();
|
||||
}
|
||||
} else if c == '(' {
|
||||
// We enceountered an opening `(` delimiter.
|
||||
block_level.push(BlockKind::Paren);
|
||||
} else if c == ')' {
|
||||
// We encountered a closing `)` delimiter. Pop off the opening `(`.
|
||||
if let Some(BlockKind::Paren) = block_level.last() {
|
||||
let _ = block_level.pop();
|
||||
}
|
||||
} else if is_termination(&block_level, c) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Otherwise, accumulate the character into the current token.
|
||||
token_contents.push(c);
|
||||
|
||||
// Consume the character.
|
||||
let _ = src.next();
|
||||
}
|
||||
|
||||
let span = Span::new(start_offset, start_offset + token_contents.len());
|
||||
|
||||
// If there is still unclosed opening delimiters, close them and add
|
||||
// synthetic closing characters to the accumulated token.
|
||||
if block_level.last().is_some() {
|
||||
// let delim: char = (*block).closing();
|
||||
// let cause = ParseError::unexpected_eof(delim.to_string(), span);
|
||||
|
||||
// while let Some(bk) = block_level.pop() {
|
||||
// token_contents.push(bk.closing());
|
||||
// }
|
||||
|
||||
return token_contents.spanned(span);
|
||||
}
|
||||
|
||||
if quote_start.is_some() {
|
||||
// The non-lite parse trims quotes on both sides, so we add the expected quote so that
|
||||
// anyone wanting to consume this partial parse (e.g., completions) will be able to get
|
||||
// correct information from the non-lite parse.
|
||||
// token_contents.push(delimiter);
|
||||
|
||||
// return (
|
||||
// token_contents.spanned(span),
|
||||
// Some(ParseError::unexpected_eof(delimiter.to_string(), span)),
|
||||
// );
|
||||
return token_contents.spanned(span);
|
||||
}
|
||||
|
||||
token_contents.spanned(span)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::DetectColumns;
|
||||
use super::ShellError;
|
||||
|
||||
#[test]
|
||||
fn examples_work_as_expected() -> Result<(), ShellError> {
|
||||
use crate::examples::test as test_examples;
|
||||
|
||||
test_examples(DetectColumns {})
|
||||
}
|
||||
}
|
3
crates/nu-command/src/commands/strings/detect/mod.rs
Normal file
3
crates/nu-command/src/commands/strings/detect/mod.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub mod columns;
|
||||
|
||||
pub use columns::DetectColumns;
|
@ -1,5 +1,6 @@
|
||||
mod build_string;
|
||||
mod char_;
|
||||
mod detect;
|
||||
mod format;
|
||||
mod lines;
|
||||
mod parse;
|
||||
@ -10,6 +11,7 @@ mod str_;
|
||||
|
||||
pub use build_string::BuildString;
|
||||
pub use char_::Char;
|
||||
pub use detect::DetectColumns;
|
||||
pub use format::*;
|
||||
pub use lines::Lines;
|
||||
pub use parse::*;
|
||||
|
@ -76,17 +76,14 @@ impl ConfigExtensions for NuConfig {
|
||||
fn header_style(&self) -> TextStyle {
|
||||
// FIXME: I agree, this is the long way around, please suggest and alternative.
|
||||
let head_color = get_color_from_key_and_subkey(self, "color_config", "header_color");
|
||||
let head_color_style = match head_color {
|
||||
Some(s) => {
|
||||
lookup_ansi_color_style(s.as_string().unwrap_or_else(|_| "green".to_string()))
|
||||
}
|
||||
None => nu_ansi_term::Color::Green.normal(),
|
||||
};
|
||||
let head_bold = get_color_from_key_and_subkey(self, "color_config", "header_bold");
|
||||
let head_bold_bool = match head_bold {
|
||||
Some(b) => header_bold_from_value(Some(&b)),
|
||||
None => true,
|
||||
let (head_color_style, head_bold_bool) = match head_color {
|
||||
Some(s) => (
|
||||
lookup_ansi_color_style(s.as_string().unwrap_or_else(|_| "green".to_string())),
|
||||
header_bold_from_value(Some(&s)),
|
||||
),
|
||||
None => (nu_ansi_term::Color::Green.normal(), true),
|
||||
};
|
||||
|
||||
let head_align = get_color_from_key_and_subkey(self, "color_config", "header_align");
|
||||
let head_alignment = match head_align {
|
||||
Some(a) => header_alignment_from_value(Some(&a)),
|
||||
|
@ -127,6 +127,7 @@ pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Bo
|
||||
whole_stream_command(AnsiStrip),
|
||||
whole_stream_command(AnsiGradient),
|
||||
whole_stream_command(Char),
|
||||
whole_stream_command(DetectColumns),
|
||||
// Column manipulation
|
||||
whole_stream_command(DropColumn),
|
||||
whole_stream_command(MoveColumn),
|
||||
|
@ -306,3 +306,21 @@ fn rm_wildcard_leading_dot_deletes_dotfiles() {
|
||||
assert!(!files_exist_at(vec![".bar"], dirs.test()));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn removes_files_with_case_sensitive_glob_matches_by_default() {
|
||||
Playground::setup("glob_test", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("A0"), EmptyFile("a1")]);
|
||||
|
||||
nu!(
|
||||
cwd: dirs.root(),
|
||||
"rm glob_test/A*"
|
||||
);
|
||||
|
||||
let deleted_path = dirs.test().join("A0");
|
||||
let skipped_path = dirs.test().join("a1");
|
||||
|
||||
assert!(!deleted_path.exists());
|
||||
assert!(skipped_path.exists());
|
||||
})
|
||||
}
|
||||
|
@ -4,19 +4,19 @@ description = "Completions for nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-completion"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-engine = { version = "0.40.0", path="../nu-engine" }
|
||||
nu-data = { version = "0.40.0", path="../nu-data" }
|
||||
nu-parser = { version = "0.40.0", path="../nu-parser" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
|
@ -4,7 +4,7 @@ description = "CLI for nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-data"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
@ -27,17 +27,14 @@ sha2 = "0.9.3"
|
||||
sys-locale = "0.1.0"
|
||||
toml = "0.5.8"
|
||||
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-table = { version = "0.38.0", path="../nu-table" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
users = "0.11.0"
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-table = { version = "0.40.0", path="../nu-table" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
|
||||
[features]
|
||||
dataframe = ["nu-protocol/dataframe"]
|
||||
|
@ -102,7 +102,6 @@ pub fn string_to_lookup_value(str_prim: &str) -> String {
|
||||
"separator_color" => "separator_color".to_string(),
|
||||
"header_align" => "header_align".to_string(),
|
||||
"header_color" => "header_color".to_string(),
|
||||
"header_bold" => "header_bold".to_string(),
|
||||
"header_style" => "header_style".to_string(),
|
||||
"index_color" => "index_color".to_string(),
|
||||
"leading_trailing_space_bg" => "leading_trailing_space_bg".to_string(),
|
||||
@ -144,7 +143,6 @@ pub fn get_color_config(config: &NuConfig) -> HashMap<String, Style> {
|
||||
hm.insert("separator_color".to_string(), Color::White.normal());
|
||||
hm.insert("header_align".to_string(), Color::Green.bold());
|
||||
hm.insert("header_color".to_string(), Color::Green.bold());
|
||||
hm.insert("header_bold".to_string(), Color::Green.bold());
|
||||
hm.insert("header_style".to_string(), Style::default());
|
||||
hm.insert("index_color".to_string(), Color::Green.bold());
|
||||
hm.insert(
|
||||
@ -204,9 +202,6 @@ pub fn get_color_config(config: &NuConfig) -> HashMap<String, Style> {
|
||||
"header_color" => {
|
||||
update_hashmap(key, value, &mut hm);
|
||||
}
|
||||
"header_bold" => {
|
||||
update_hashmap(key, value, &mut hm);
|
||||
}
|
||||
"header_style" => {
|
||||
update_hashmap(key, value, &mut hm);
|
||||
}
|
||||
@ -358,14 +353,7 @@ pub fn style_primitive(primitive: &str, color_hm: &HashMap<String, Style>) -> Te
|
||||
let style = color_hm.get("header_color");
|
||||
match style {
|
||||
Some(s) => TextStyle::with_style(Alignment::Center, *s),
|
||||
None => TextStyle::default_header(),
|
||||
}
|
||||
}
|
||||
"header_bold" => {
|
||||
let style = color_hm.get("header_bold");
|
||||
match style {
|
||||
Some(s) => TextStyle::with_style(Alignment::Center, *s),
|
||||
None => TextStyle::default_header(),
|
||||
None => TextStyle::default_header().bold(Some(true)),
|
||||
}
|
||||
}
|
||||
"header_style" => {
|
||||
|
@ -4,27 +4,26 @@ description = "Core commands for nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-engine"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[dependencies]
|
||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-data = { version = "0.40.0", path="../nu-data" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-parser = { version = "0.40.0", path="../nu-parser" }
|
||||
nu-plugin = { version = "0.40.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-stream = { version = "0.40.0", path="../nu-stream" }
|
||||
nu-value-ext = { version = "0.40.0", path="../nu-value-ext" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
|
||||
trash = { version="1.3.0", optional=true }
|
||||
which = { version="4.0.2", optional=true }
|
||||
codespan-reporting = "0.11.0"
|
||||
ansi_term = "0.12.1"
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
bytes = "0.5.6"
|
||||
bytes = "1.1.0"
|
||||
chrono = { version="0.4.19", features=["serde"] }
|
||||
derive-new = "0.5.8"
|
||||
dirs-next = "2.0.0"
|
||||
@ -51,7 +50,7 @@ umask = "1.0.0"
|
||||
users = "0.11.0"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
hamcrest2 = "0.3.0"
|
||||
|
||||
[features]
|
||||
|
@ -28,6 +28,12 @@ use nu_errors::ShellError;
|
||||
use nu_protocol::{Primitive, ReturnSuccess, UntaggedValue};
|
||||
use nu_source::Tagged;
|
||||
|
||||
const GLOB_PARAMS: glob::MatchOptions = glob::MatchOptions {
|
||||
case_sensitive: true,
|
||||
require_literal_separator: false,
|
||||
require_literal_leading_dot: false,
|
||||
};
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||
pub enum FilesystemShellMode {
|
||||
Cli,
|
||||
@ -159,7 +165,7 @@ impl Shell for FilesystemShell {
|
||||
|
||||
let hidden_dir_specified = is_hidden_dir(&path);
|
||||
|
||||
let mut paths = glob::glob(&path.to_string_lossy())
|
||||
let mut paths = glob::glob_with(&path.to_string_lossy(), GLOB_PARAMS)
|
||||
.map_err(|e| ShellError::labeled_error(e.to_string(), "invalid pattern", &p_tag))?
|
||||
.peekable();
|
||||
|
||||
@ -352,7 +358,7 @@ impl Shell for FilesystemShell {
|
||||
let source = path.join(&src.item);
|
||||
let destination = path.join(&dst.item);
|
||||
|
||||
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
|
||||
let sources: Vec<_> = match glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS) {
|
||||
Ok(files) => files.collect(),
|
||||
Err(e) => {
|
||||
return Err(ShellError::labeled_error(
|
||||
@ -521,8 +527,8 @@ impl Shell for FilesystemShell {
|
||||
let source = path.join(&src.item);
|
||||
let destination = path.join(&dst.item);
|
||||
|
||||
let mut sources =
|
||||
glob::glob(&source.to_string_lossy()).map_or_else(|_| Vec::new(), Iterator::collect);
|
||||
let mut sources = glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS)
|
||||
.map_or_else(|_| Vec::new(), Iterator::collect);
|
||||
|
||||
if sources.is_empty() {
|
||||
return Err(ShellError::labeled_error(
|
||||
@ -650,7 +656,7 @@ impl Shell for FilesystemShell {
|
||||
&path.to_string_lossy(),
|
||||
glob::MatchOptions {
|
||||
require_literal_leading_dot: true,
|
||||
..Default::default()
|
||||
..GLOB_PARAMS
|
||||
},
|
||||
) {
|
||||
Ok(files) => {
|
||||
|
@ -4,14 +4,14 @@ description = "Core error subsystem for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-errors"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
codespan-reporting = { version="0.11.0", features=["serialization"] }
|
||||
|
@ -4,7 +4,7 @@ description = "Fork of serde-hjson"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-json"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
# 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 }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
serde_json = "1.0.39"
|
||||
|
@ -4,7 +4,7 @@ description = "Nushell parser"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-parser"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[dependencies]
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
@ -15,12 +15,12 @@ num-bigint = { version="0.3.1", features=["serde"] }
|
||||
itertools = "0.10.0"
|
||||
smart-default = "0.6.0"
|
||||
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-data = { version = "0.40.0", path="../nu-data" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
nu-test-support = { version = "0.40.0", path="../nu-test-support" }
|
||||
|
||||
[features]
|
||||
stable = []
|
||||
|
@ -1559,11 +1559,16 @@ fn parse_internal_command(
|
||||
if error.is_none() {
|
||||
error = err;
|
||||
}
|
||||
} else if error.is_none() {
|
||||
error = Some(ParseError::argument_error(
|
||||
lite_cmd.parts[0].clone(),
|
||||
ArgumentError::MissingValueForName(full_name.to_owned()),
|
||||
));
|
||||
} else {
|
||||
if error.is_none() {
|
||||
error = Some(ParseError::argument_error(
|
||||
lite_cmd.parts[0].clone(),
|
||||
ArgumentError::MissingValueForName(
|
||||
full_name.to_owned(),
|
||||
),
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ description = "Path handling library for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-path"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[dependencies]
|
||||
dirs-next = "2.0.0"
|
||||
|
@ -4,17 +4,17 @@ description = "Nushell Plugin"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-plugin"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-test-support = { path="../nu-test-support", version = "0.38.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
nu-test-support = { path="../nu-test-support", version = "0.40.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" }
|
||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||
serde = { version="1.0", features=["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -55,7 +55,6 @@ pub fn serve_plugin(plugin: &mut dyn Plugin) {
|
||||
match command {
|
||||
Ok(NuCommand::config) => {
|
||||
send_response(plugin.config());
|
||||
return;
|
||||
}
|
||||
Ok(NuCommand::begin_filter { params }) => {
|
||||
send_response(plugin.begin_filter(params));
|
||||
@ -65,23 +64,19 @@ pub fn serve_plugin(plugin: &mut dyn Plugin) {
|
||||
}
|
||||
Ok(NuCommand::end_filter) => {
|
||||
send_response(plugin.end_filter());
|
||||
return;
|
||||
}
|
||||
|
||||
Ok(NuCommand::sink { params }) => {
|
||||
plugin.sink(params.0, params.1);
|
||||
return;
|
||||
}
|
||||
Ok(NuCommand::quit) => {
|
||||
plugin.quit();
|
||||
return;
|
||||
}
|
||||
e => {
|
||||
send_response(ShellError::untagged_runtime_error(format!(
|
||||
"Could not handle plugin message: {} {:?}",
|
||||
input, e
|
||||
)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ description = "Pretty hex dump of bytes slice in the common style."
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-pretty-hex"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
@ -16,11 +16,11 @@ name = "nu_pretty_hex"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
nu-ansi-term = { path="../nu-ansi-term", version = "0.38.0" }
|
||||
nu-ansi-term = { path="../nu-ansi-term", version = "0.40.0" }
|
||||
rand = "0.8.3"
|
||||
|
||||
[dev-dependencies]
|
||||
heapless = "0.6.1"
|
||||
heapless = { version = "0.7.8", default-features = false }
|
||||
|
||||
# [features]
|
||||
# default = ["alloc"]
|
||||
|
@ -166,7 +166,7 @@ fn test_hex_write_with_simple_config() {
|
||||
core::str::from_utf8(b"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f").unwrap();
|
||||
// let expected =
|
||||
// "\u{1b}[38;5;242m00\u{1b}[0m \u{1b}[1;35m01\u{1b}[0m \u{1b}[1;35m02\u{1b}[0m \u{1b}[1;";
|
||||
let mut buffer = heapless::Vec::<u8, heapless::consts::U50>::new();
|
||||
let mut buffer = heapless::Vec::<u8, 50>::new();
|
||||
|
||||
hex_write(&mut buffer, &bytes, config, None).unwrap();
|
||||
|
||||
|
@ -4,7 +4,7 @@ description = "Core values and protocols for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-protocol"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
@ -18,8 +18,8 @@ derive-new = "0.5.8"
|
||||
getset = "0.1.1"
|
||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||
log = "0.4.14"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
num-bigint = { version="0.3.1", features=["serde"] }
|
||||
num-integer = "0.1.44"
|
||||
num-traits = "0.2.14"
|
||||
@ -27,9 +27,9 @@ serde = { version="1.0", features=["derive"] }
|
||||
serde_bytes = "0.11.5"
|
||||
|
||||
[dependencies.polars]
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
optional = true
|
||||
features = ["default", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-duration-ns"]
|
||||
features = ["default", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-date", "dtype-datetime", "dtype-time"]
|
||||
|
||||
[features]
|
||||
dataframe = ["polars"]
|
||||
|
@ -603,7 +603,7 @@ where
|
||||
{
|
||||
match series.dtype() {
|
||||
DataType::UInt32 | DataType::Int32 | DataType::UInt64 => {
|
||||
let to_i64 = series.cast_with_dtype(&DataType::Int64);
|
||||
let to_i64 = series.cast(&DataType::Int64);
|
||||
|
||||
match to_i64 {
|
||||
Ok(series) => {
|
||||
@ -661,7 +661,7 @@ where
|
||||
{
|
||||
match series.dtype() {
|
||||
DataType::Float32 => {
|
||||
let to_f64 = series.cast_with_dtype(&DataType::Float64);
|
||||
let to_f64 = series.cast(&DataType::Float64);
|
||||
|
||||
match to_f64 {
|
||||
Ok(series) => {
|
||||
@ -731,7 +731,7 @@ where
|
||||
{
|
||||
match series.dtype() {
|
||||
DataType::UInt32 | DataType::Int32 | DataType::UInt64 => {
|
||||
let to_i64 = series.cast_with_dtype(&DataType::Int64);
|
||||
let to_i64 = series.cast(&DataType::Int64);
|
||||
|
||||
match to_i64 {
|
||||
Ok(series) => {
|
||||
@ -789,7 +789,7 @@ where
|
||||
{
|
||||
match series.dtype() {
|
||||
DataType::Float32 => {
|
||||
let to_f64 = series.cast_with_dtype(&DataType::Float64);
|
||||
let to_f64 = series.cast(&DataType::Float64);
|
||||
|
||||
match to_f64 {
|
||||
Ok(series) => {
|
||||
|
@ -8,8 +8,8 @@ use nu_errors::ShellError;
|
||||
use nu_source::{Span, Tag};
|
||||
use num_bigint::BigInt;
|
||||
use polars::prelude::{
|
||||
DataFrame, DataType, Date64Type, Int64Type, IntoSeries, NamedFrom, NewChunkedArray, ObjectType,
|
||||
PolarsNumericType, Series, TimeUnit,
|
||||
DataFrame, DataType, DatetimeChunked, Int64Type, IntoSeries, NamedFrom, NewChunkedArray,
|
||||
ObjectType, PolarsNumericType, Series,
|
||||
};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
@ -310,8 +310,8 @@ pub fn create_column(
|
||||
}
|
||||
}
|
||||
}
|
||||
DataType::Date32 => {
|
||||
let casted = series.date32().map_err(|e| {
|
||||
DataType::Date => {
|
||||
let casted = series.date().map_err(|e| {
|
||||
ShellError::labeled_error(
|
||||
"Casting error",
|
||||
format!("casting error: {}", e),
|
||||
@ -347,8 +347,8 @@ pub fn create_column(
|
||||
|
||||
Ok(Column::new(casted.name().into(), values))
|
||||
}
|
||||
DataType::Date64 => {
|
||||
let casted = series.date64().map_err(|e| {
|
||||
DataType::Datetime => {
|
||||
let casted = series.datetime().map_err(|e| {
|
||||
ShellError::labeled_error(
|
||||
"Casting error",
|
||||
format!("casting error: {}", e),
|
||||
@ -384,8 +384,8 @@ pub fn create_column(
|
||||
|
||||
Ok(Column::new(casted.name().into(), values))
|
||||
}
|
||||
DataType::Time64(timeunit) | DataType::Duration(timeunit) => {
|
||||
let casted = series.time64_nanosecond().map_err(|e| {
|
||||
DataType::Time => {
|
||||
let casted = series.time().map_err(|e| {
|
||||
ShellError::labeled_error(
|
||||
"Casting error",
|
||||
format!("casting error: {}", e),
|
||||
@ -398,14 +398,7 @@ pub fn create_column(
|
||||
.skip(from_row)
|
||||
.take(size)
|
||||
.map(|v| match v {
|
||||
Some(a) => {
|
||||
let nanoseconds = match timeunit {
|
||||
TimeUnit::Second => a / 1_000_000_000,
|
||||
TimeUnit::Millisecond => a / 1_000_000,
|
||||
TimeUnit::Microsecond => a / 1_000,
|
||||
TimeUnit::Nanosecond => a,
|
||||
};
|
||||
|
||||
Some(nanoseconds) => {
|
||||
let untagged = if let Some(bigint) = BigInt::from_i64(nanoseconds) {
|
||||
UntaggedValue::Primitive(Primitive::Duration(bigint))
|
||||
} else {
|
||||
@ -633,7 +626,8 @@ pub fn from_parsed_columns(
|
||||
}
|
||||
});
|
||||
|
||||
let res = ChunkedArray::<Date64Type>::new_from_opt_iter(&name, it);
|
||||
let res: DatetimeChunked =
|
||||
ChunkedArray::<Int64Type>::new_from_opt_iter(&name, it).into();
|
||||
|
||||
df_series.push(res.into_series())
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ impl PartialEq for NuDataFrame {
|
||||
// Casting needed to compare other numeric types with nushell numeric type.
|
||||
// In nushell we only have i64 integer numeric types and any array created
|
||||
// with nushell untagged primitives will be of type i64
|
||||
DataType::UInt32 => match self_series.cast_with_dtype(&DataType::Int64) {
|
||||
DataType::UInt32 => match self_series.cast(&DataType::Int64) {
|
||||
Ok(series) => series,
|
||||
Err(_) => return false,
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nu-serde"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
edition = "2018"
|
||||
authors = ["The Nu Project Contributors"]
|
||||
description = "Turn any value into a nu-protocol::Value with serde"
|
||||
@ -10,8 +10,8 @@ documentation = "https://docs.rs/nu-serde"
|
||||
|
||||
[dependencies]
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
nu-protocol = { version = "0.38.0", path = "../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path = "../nu-source" }
|
||||
nu-protocol = { version = "0.40.0", path = "../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path = "../nu-source" }
|
||||
serde = "1"
|
||||
thiserror = "1"
|
||||
|
||||
|
@ -4,7 +4,7 @@ description = "A source string characterizer for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-source"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -4,12 +4,12 @@ description = "Nushell stream"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-stream"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
|
||||
[features]
|
||||
stable = []
|
||||
|
@ -4,7 +4,7 @@ description = "Nushell table printing"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-table"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[[bin]]
|
||||
@ -13,7 +13,7 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
atty = "0.2.14"
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
|
||||
regex = "1.4"
|
||||
strip-ansi-escapes = "0.1.1"
|
||||
|
@ -4,16 +4,16 @@ description = "Support for writing Nushell tests"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-test-support"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-path = { version = "0.40.0", path="../nu-path" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
chrono = "0.4.19"
|
||||
|
@ -4,15 +4,15 @@ description = "Extension traits for values in Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu-value-ext"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
|
||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||
itertools = "0.10.0"
|
||||
|
@ -4,21 +4,21 @@ description = "A binary viewer plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_binaryview"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
crossterm = "0.19"
|
||||
image = { version="0.22.4", default_features=false, features=["png_codec", "jpeg"] }
|
||||
image = { version = "0.23.14", default_features = false, features = ["png", "jpeg"] }
|
||||
neso = "0.5.0"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
||||
nu-pretty-hex = { version = "0.38.0", path="../nu-pretty-hex" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
nu-ansi-term = { version = "0.40.0", path="../nu-ansi-term" }
|
||||
nu-pretty-hex = { version = "0.40.0", path="../nu-pretty-hex" }
|
||||
rawkey = "0.1.3"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -167,7 +167,7 @@ impl RenderContext {
|
||||
|
||||
#[derive(Debug)]
|
||||
struct RawImageBuffer {
|
||||
dimensions: (u64, u64),
|
||||
dimensions: (u32, u32),
|
||||
colortype: image::ColorType,
|
||||
buffer: Vec<u8>,
|
||||
}
|
||||
@ -175,11 +175,12 @@ struct RawImageBuffer {
|
||||
fn load_from_png_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::error::Error>> {
|
||||
use image::ImageDecoder;
|
||||
|
||||
let decoder = image::png::PNGDecoder::new(buffer)?;
|
||||
let decoder = image::codecs::png::PngDecoder::new(buffer)?;
|
||||
|
||||
let dimensions = decoder.dimensions();
|
||||
let colortype = decoder.colortype();
|
||||
let buffer = decoder.read_image()?;
|
||||
let colortype = decoder.color_type();
|
||||
let mut buffer: Vec<u8> = vec![0; decoder.total_bytes() as usize];
|
||||
decoder.read_image(&mut buffer)?;
|
||||
|
||||
Ok(RawImageBuffer {
|
||||
dimensions,
|
||||
@ -191,11 +192,12 @@ fn load_from_png_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::er
|
||||
fn load_from_jpg_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::error::Error>> {
|
||||
use image::ImageDecoder;
|
||||
|
||||
let decoder = image::jpeg::JPEGDecoder::new(buffer)?;
|
||||
let decoder = image::codecs::jpeg::JpegDecoder::new(buffer)?;
|
||||
|
||||
let dimensions = decoder.dimensions();
|
||||
let colortype = decoder.colortype();
|
||||
let buffer = decoder.read_image()?;
|
||||
let colortype = decoder.color_type();
|
||||
let mut buffer: Vec<u8> = vec![0; decoder.total_bytes() as usize];
|
||||
decoder.read_image(&mut buffer)?;
|
||||
|
||||
Ok(RawImageBuffer {
|
||||
dimensions,
|
||||
@ -245,7 +247,7 @@ pub fn view_contents(
|
||||
render_context.clear();
|
||||
|
||||
match raw_image_buffer.colortype {
|
||||
image::ColorType::RGBA(8) => {
|
||||
image::ColorType::Rgba8 => {
|
||||
let img = image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::from_vec(
|
||||
raw_image_buffer.dimensions.0 as u32,
|
||||
raw_image_buffer.dimensions.1 as u32,
|
||||
@ -257,7 +259,7 @@ pub fn view_contents(
|
||||
&img,
|
||||
render_context.width as u32,
|
||||
render_context.height as u32,
|
||||
image::FilterType::Lanczos3,
|
||||
image::imageops::FilterType::Lanczos3,
|
||||
);
|
||||
|
||||
for (count, pixel) in resized_img.pixels().enumerate() {
|
||||
@ -266,7 +268,7 @@ pub fn view_contents(
|
||||
render_context.frame_buffer[count] = (rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
}
|
||||
image::ColorType::RGB(8) => {
|
||||
image::ColorType::Rgb8 => {
|
||||
let img = image::ImageBuffer::<image::Rgb<u8>, Vec<u8>>::from_vec(
|
||||
raw_image_buffer.dimensions.0 as u32,
|
||||
raw_image_buffer.dimensions.1 as u32,
|
||||
@ -278,7 +280,7 @@ pub fn view_contents(
|
||||
&img,
|
||||
render_context.width as u32,
|
||||
render_context.height as u32,
|
||||
image::FilterType::Lanczos3,
|
||||
image::imageops::FilterType::Lanczos3,
|
||||
);
|
||||
|
||||
for (count, pixel) in resized_img.pixels().enumerate() {
|
||||
@ -359,7 +361,7 @@ pub fn view_contents_interactive(
|
||||
&img,
|
||||
render_context.width as u32,
|
||||
render_context.height as u32,
|
||||
image::FilterType::Lanczos3,
|
||||
image::imageops::FilterType::Lanczos3,
|
||||
);
|
||||
|
||||
render_context.clear();
|
||||
|
@ -4,18 +4,18 @@ description = "A plugin to display charts"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_chart"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-data = { path="../nu-data", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
||||
nu-data = { path="../nu-data", version = "0.40.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" }
|
||||
|
||||
crossterm = "0.19.0"
|
||||
tui = { version="0.15.0", default-features=false, features=["crossterm"] }
|
||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_from_bson"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
bson = { version="0.14.1", features=["decimal128"] }
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
bson = { version = "2.0.1", features = [ "chrono-0_4" ] }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bigdecimal::BigDecimal;
|
||||
use bson::{decode_document, spec::BinarySubtype, Bson};
|
||||
use bson::{spec::BinarySubtype, Bson};
|
||||
use nu_errors::{ExpectedRange, ShellError};
|
||||
use nu_protocol::{Primitive, ReturnSuccess, ReturnValue, TaggedDictBuilder, UntaggedValue, Value};
|
||||
use nu_source::{SpannedItem, Tag};
|
||||
@ -35,7 +35,7 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
||||
let span = tag.span;
|
||||
|
||||
Ok(match v {
|
||||
Bson::FloatingPoint(n) => UntaggedValue::Primitive(Primitive::from(*n)).into_value(&tag),
|
||||
Bson::Double(n) => UntaggedValue::Primitive(Primitive::from(*n)).into_value(&tag),
|
||||
Bson::String(s) => {
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(s))).into_value(&tag)
|
||||
}
|
||||
@ -50,20 +50,22 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
||||
}
|
||||
Bson::Boolean(b) => UntaggedValue::Primitive(Primitive::Boolean(*b)).into_value(&tag),
|
||||
Bson::Null => UntaggedValue::Primitive(Primitive::Nothing).into_value(&tag),
|
||||
Bson::RegExp(r, opts) => {
|
||||
Bson::RegularExpression(regx) => {
|
||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||
collected.insert_value(
|
||||
"$regex".to_string(),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(r))).into_value(&tag),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(®x.pattern)))
|
||||
.into_value(&tag),
|
||||
);
|
||||
collected.insert_value(
|
||||
"$options".to_string(),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(opts))).into_value(&tag),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(®x.options)))
|
||||
.into_value(&tag),
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::I32(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||
Bson::I64(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||
Bson::Int32(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||
Bson::Int64(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||
Bson::Decimal128(n) => {
|
||||
// TODO: this really isn't great, and we should update this to do a higher
|
||||
// fidelity translation
|
||||
@ -84,41 +86,43 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::JavaScriptCodeWithScope(js, doc) => {
|
||||
Bson::JavaScriptCodeWithScope(js) => {
|
||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||
collected.insert_value(
|
||||
"$javascript".to_string(),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(js))).into_value(&tag),
|
||||
UntaggedValue::Primitive(Primitive::String(String::from(&js.code)))
|
||||
.into_value(&tag),
|
||||
);
|
||||
collected.insert_value(
|
||||
"$scope".to_string(),
|
||||
convert_bson_value_to_nu_value(&Bson::Document(doc.to_owned()), tag)?,
|
||||
convert_bson_value_to_nu_value(&Bson::Document(js.scope.to_owned()), tag)?,
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::TimeStamp(ts) => {
|
||||
Bson::Timestamp(ts) => {
|
||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||
collected.insert_value(
|
||||
"$timestamp".to_string(),
|
||||
UntaggedValue::int(*ts).into_value(&tag),
|
||||
UntaggedValue::int(ts.time).into_value(&tag),
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::Binary(bst, bytes) => {
|
||||
Bson::Binary(binary) => {
|
||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||
collected.insert_value(
|
||||
"$binary_subtype".to_string(),
|
||||
match bst {
|
||||
BinarySubtype::UserDefined(u) => UntaggedValue::int(*u),
|
||||
_ => {
|
||||
UntaggedValue::Primitive(Primitive::String(binary_subtype_to_string(*bst)))
|
||||
}
|
||||
match binary.subtype {
|
||||
BinarySubtype::UserDefined(u) => UntaggedValue::int(u),
|
||||
_ => UntaggedValue::Primitive(Primitive::String(binary_subtype_to_string(
|
||||
binary.subtype,
|
||||
))),
|
||||
}
|
||||
.into_value(&tag),
|
||||
);
|
||||
collected.insert_value(
|
||||
"$binary".to_string(),
|
||||
UntaggedValue::Primitive(Primitive::Binary(bytes.to_owned())).into_value(&tag),
|
||||
UntaggedValue::Primitive(Primitive::Binary(binary.bytes.to_owned()))
|
||||
.into_value(&tag),
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
@ -130,8 +134,8 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::UtcDatetime(dt) => {
|
||||
UntaggedValue::Primitive(Primitive::Date((*dt).into())).into_value(&tag)
|
||||
Bson::DateTime(dt) => {
|
||||
UntaggedValue::Primitive(Primitive::Date(dt.to_chrono().into())).into_value(&tag)
|
||||
}
|
||||
Bson::Symbol(s) => {
|
||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||
@ -141,6 +145,11 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
||||
);
|
||||
collected.into_value()
|
||||
}
|
||||
Bson::Undefined | Bson::MaxKey | Bson::MinKey | Bson::DbPointer(_) => {
|
||||
// TODO Impelmenting Bson::Undefined, Bson::MaxKey, Bson::MinKey and Bson::DbPointer
|
||||
// These Variants weren't present in the previous version.
|
||||
TaggedDictBuilder::new(tag).into_value()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -184,7 +193,7 @@ impl std::io::Read for BytesReader {
|
||||
pub fn from_bson_bytes_to_value(bytes: Vec<u8>, tag: impl Into<Tag>) -> Result<Value, ShellError> {
|
||||
let mut docs = Vec::new();
|
||||
let mut b_reader = BytesReader::new(bytes);
|
||||
while let Ok(v) = decode_document(&mut b_reader) {
|
||||
while let Ok(v) = bson::de::from_reader(&mut b_reader) {
|
||||
docs.push(Bson::Document(v));
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,11 @@ version = "0.1.0"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
tempfile = "3.2.0"
|
||||
mp4 = "0.8.2"
|
||||
mp4 = "0.9.0"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -27,7 +27,7 @@ pub fn convert_mp4_file_to_nu_value(path: &Path, tag: Tag) -> Result<Value, mp4:
|
||||
|
||||
// Build tracks table
|
||||
let mut tracks = Vec::new();
|
||||
for track in mp4.tracks() {
|
||||
for track in mp4.tracks().values() {
|
||||
let mut curr_track_dict = TaggedDictBuilder::new(tag.clone());
|
||||
|
||||
curr_track_dict.insert_untagged("track id", UntaggedValue::int(track.track_id()));
|
||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_from_sqlite"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
tempfile = "3.2.0"
|
||||
|
||||
[dependencies.rusqlite]
|
||||
|
@ -4,18 +4,18 @@ description = "A version incrementer plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_inc"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-test-support = { path="../nu-test-support", version = "0.38.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
nu-test-support = { path="../nu-test-support", version = "0.40.0" }
|
||||
nu-value-ext = { path="../nu-value-ext", version = "0.40.0" }
|
||||
|
||||
semver = "0.11.0"
|
||||
|
||||
|
@ -4,15 +4,15 @@ description = "A regex match plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_match"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
regex = "1.4.3"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -4,14 +4,14 @@ description = "query json files with gjson"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_query_json"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
gjson = "0.7.1"
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-plugin = { version = "0.40.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
|
@ -4,17 +4,17 @@ description = "An S3 plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_s3"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
futures = { version="0.3.12", features=["compat", "io-compat"] }
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
s3handler = "0.7"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -4,18 +4,17 @@ description = "web scraping using css selector"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_selector"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nipper = "0.1.9"
|
||||
scraper = "0.12.0"
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-plugin = { version = "0.40.0", path="../nu-plugin" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
|
||||
[dev-dependencies]
|
||||
indexmap = { version="1.7", features=["serde-1"] }
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::{selector::begin_selector_query, Selector};
|
||||
use nu_errors::ShellError;
|
||||
use nu_plugin::Plugin;
|
||||
use nu_protocol::{
|
||||
CallInfo, Primitive, ReturnSuccess, ReturnValue, Signature, SyntaxShape, UntaggedValue, Value,
|
||||
};
|
||||
|
||||
use crate::{selector::begin_selector_query, Selector};
|
||||
use scraper::Selector as ScraperSelector;
|
||||
|
||||
impl Plugin for Selector {
|
||||
fn config(&mut self) -> Result<Signature, ShellError> {
|
||||
@ -63,6 +63,13 @@ impl Plugin for Selector {
|
||||
}
|
||||
|
||||
fn filter(&mut self, input: Value) -> Result<Vec<ReturnValue>, ShellError> {
|
||||
if !self.query.is_empty() && ScraperSelector::parse(&self.query).is_err() {
|
||||
return Err(ShellError::labeled_error(
|
||||
"Can not parse this query as a valid css selector",
|
||||
"Parse error",
|
||||
&self.tag,
|
||||
));
|
||||
}
|
||||
match input {
|
||||
Value {
|
||||
value: UntaggedValue::Primitive(Primitive::String(s)),
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::Table;
|
||||
use nipper::Document;
|
||||
use nu_protocol::{value::StringExt, Primitive, TaggedDictBuilder, UntaggedValue, Value};
|
||||
use nu_source::Tag;
|
||||
use scraper::{Html, Selector as ScraperSelector};
|
||||
|
||||
pub struct Selector {
|
||||
pub query: String,
|
||||
@ -35,7 +35,7 @@ impl Default for Selector {
|
||||
}
|
||||
|
||||
pub fn begin_selector_query(input_html: String, selector: &Selector) -> Vec<Value> {
|
||||
if selector.as_table.is_some() {
|
||||
if !selector.as_table.value.is_string() {
|
||||
retrieve_tables(input_html.as_str(), &selector.as_table, selector.inspect)
|
||||
} else {
|
||||
match selector.attribute.is_empty() {
|
||||
@ -166,13 +166,14 @@ fn execute_selector_query_with_attribute(
|
||||
query_string: &str,
|
||||
attribute: &str,
|
||||
) -> Vec<Value> {
|
||||
let doc = Document::from(input_string);
|
||||
let doc = Html::parse_fragment(input_string);
|
||||
|
||||
doc.select(query_string)
|
||||
.iter()
|
||||
doc.select(&css(query_string))
|
||||
.map(|selection| {
|
||||
selection
|
||||
.attr_or(attribute, "")
|
||||
.value()
|
||||
.attr(attribute)
|
||||
.unwrap_or("")
|
||||
.to_string()
|
||||
.to_string_value_create_tag()
|
||||
})
|
||||
@ -180,57 +181,51 @@ fn execute_selector_query_with_attribute(
|
||||
}
|
||||
|
||||
fn execute_selector_query(input_string: &str, query_string: &str, as_html: bool) -> Vec<Value> {
|
||||
let doc = Document::from(input_string);
|
||||
let doc = Html::parse_fragment(input_string);
|
||||
|
||||
match as_html {
|
||||
true => doc
|
||||
.select(query_string)
|
||||
.iter()
|
||||
.map(|selection| selection.html().to_string().to_string_value_create_tag())
|
||||
.select(&css(query_string))
|
||||
.map(|selection| selection.html().to_string_value_create_tag())
|
||||
.collect(),
|
||||
false => doc
|
||||
.select(query_string)
|
||||
.iter()
|
||||
.map(|selection| selection.text().to_string().to_string_value_create_tag())
|
||||
.select(&css(query_string))
|
||||
.map(|selection| {
|
||||
selection
|
||||
.text()
|
||||
.fold("".to_string(), |acc, x| format!("{}{}", acc, x))
|
||||
.to_string_value_create_tag()
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn css(selector: &str) -> ScraperSelector {
|
||||
ScraperSelector::parse(selector).expect("this should never trigger")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use nipper::Document;
|
||||
use super::*;
|
||||
|
||||
const SIMPLE_LIST: &'static str = r#"
|
||||
<ul>
|
||||
<li>Coffee</li>
|
||||
<li>Tea</li>
|
||||
<li>Milk</li>
|
||||
</ul>
|
||||
"#;
|
||||
|
||||
#[test]
|
||||
fn create_document_from_string() {
|
||||
let html = r#"<div name="foo" value="bar"></div>"#;
|
||||
let document = Document::from(html);
|
||||
let shouldbe =
|
||||
r#"<html><head></head><body><div name="foo" value="bar"></div></body></html>"#;
|
||||
|
||||
assert_eq!(shouldbe.to_string(), document.html().to_string());
|
||||
fn test_first_child_is_not_empty() {
|
||||
assert!(!execute_selector_query(SIMPLE_LIST, "li:first-child", false).is_empty())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modify_html_document() {
|
||||
let html = r#"<div name="foo" value="bar"></div>"#;
|
||||
let document = Document::from(html);
|
||||
let mut input = document.select(r#"div[name="foo"]"#);
|
||||
input.set_attr("id", "input");
|
||||
input.remove_attr("name");
|
||||
|
||||
let shouldbe = "bar".to_string();
|
||||
let actual = input.attr("value").unwrap().to_string();
|
||||
|
||||
assert_eq!(shouldbe, actual);
|
||||
fn test_first_child() {
|
||||
assert_eq!(
|
||||
vec!["Coffee".to_string().to_string_value_create_tag()],
|
||||
execute_selector_query(SIMPLE_LIST, "li:first-child", false)
|
||||
)
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn test_hacker_news() -> Result<(), ShellError> {
|
||||
// let html = reqwest::blocking::get("https://news.ycombinator.com")?.text()?;
|
||||
// let document = Document::from(&html);
|
||||
// let result = query(html, ".hnname a".to_string(), Tag::unknown());
|
||||
// let shouldbe = Ok(vec!["Hacker News".to_str_value_create_tag()]);
|
||||
// assert_eq!(shouldbe, result);
|
||||
// Ok(())
|
||||
// }
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
use crate::selector::css;
|
||||
use scraper::{element_ref::ElementRef, Html, Selector as ScraperSelector};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@ -263,10 +264,6 @@ impl<'a> IntoIterator for Row<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn css(selector: &'static str) -> ScraperSelector {
|
||||
ScraperSelector::parse(selector).expect("Unable to parse selector with scraper")
|
||||
}
|
||||
|
||||
fn select_cells(
|
||||
element: ElementRef,
|
||||
selector: &ScraperSelector,
|
||||
@ -343,23 +340,23 @@ mod tests {
|
||||
use indexmap::indexmap;
|
||||
use nu_protocol::UntaggedValue;
|
||||
|
||||
const TABLE_EMPTY: &'static str = r#"
|
||||
const TABLE_EMPTY: &str = r#"
|
||||
<table></table>
|
||||
"#;
|
||||
|
||||
const TABLE_TH: &'static str = r#"
|
||||
const TABLE_TH: &str = r#"
|
||||
<table>
|
||||
<tr><th>Name</th><th>Age</th></tr>
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TABLE_TD: &'static str = r#"
|
||||
const TABLE_TD: &str = r#"
|
||||
<table>
|
||||
<tr><td>Name</td><td>Age</td></tr>
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TWO_TABLES_TD: &'static str = r#"
|
||||
const TWO_TABLES_TD: &str = r#"
|
||||
<table>
|
||||
<tr><td>Name</td><td>Age</td></tr>
|
||||
</table>
|
||||
@ -368,14 +365,14 @@ mod tests {
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TABLE_TH_TD: &'static str = r#"
|
||||
const TABLE_TH_TD: &str = r#"
|
||||
<table>
|
||||
<tr><th>Name</th><th>Age</th></tr>
|
||||
<tr><td>John</td><td>20</td></tr>
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TWO_TABLES_TH_TD: &'static str = r#"
|
||||
const TWO_TABLES_TH_TD: &str = r#"
|
||||
<table>
|
||||
<tr><th>Name</th><th>Age</th></tr>
|
||||
<tr><td>John</td><td>20</td></tr>
|
||||
@ -386,21 +383,21 @@ mod tests {
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TABLE_TD_TD: &'static str = r#"
|
||||
const TABLE_TD_TD: &str = r#"
|
||||
<table>
|
||||
<tr><td>Name</td><td>Age</td></tr>
|
||||
<tr><td>John</td><td>20</td></tr>
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TABLE_TH_TH: &'static str = r#"
|
||||
const TABLE_TH_TH: &str = r#"
|
||||
<table>
|
||||
<tr><th>Name</th><th>Age</th></tr>
|
||||
<tr><th>John</th><th>20</th></tr>
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TABLE_COMPLEX: &'static str = r#"
|
||||
const TABLE_COMPLEX: &str = r#"
|
||||
<table>
|
||||
<tr><th>Name</th><th>Age</th><th>Extra</th></tr>
|
||||
<tr><td>John</td><td>20</td></tr>
|
||||
@ -410,7 +407,7 @@ mod tests {
|
||||
</table>
|
||||
"#;
|
||||
|
||||
const TWO_TABLES_COMPLEX: &'static str = r#"
|
||||
const TWO_TABLES_COMPLEX: &str = r#"
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<head><title>foo</title></head>
|
||||
@ -433,7 +430,7 @@ mod tests {
|
||||
</html>
|
||||
"#;
|
||||
|
||||
const HTML_NO_TABLE: &'static str = r#"
|
||||
const HTML_NO_TABLE: &str = r#"
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<head><title>foo</title></head>
|
||||
@ -441,7 +438,7 @@ mod tests {
|
||||
</html>
|
||||
"#;
|
||||
|
||||
const HTML_TWO_TABLES: &'static str = r#"
|
||||
const HTML_TWO_TABLES: &str = r#"
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<head><title>foo</title></head>
|
||||
@ -458,7 +455,7 @@ mod tests {
|
||||
</html>
|
||||
"#;
|
||||
|
||||
const HTML_TABLE_FRAGMENT: &'static str = r#"
|
||||
const HTML_TABLE_FRAGMENT: &str = r#"
|
||||
<table id="first">
|
||||
<tr><th>Name</th><th>Age</th></tr>
|
||||
<tr><td>John</td><td>20</td></tr>
|
||||
@ -467,7 +464,7 @@ mod tests {
|
||||
</html>
|
||||
"#;
|
||||
|
||||
const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &'static str = r#"
|
||||
const HTML_TABLE_WIKIPEDIA_WITH_COLUMN_NAMES: &str = r#"
|
||||
<table class="wikitable">
|
||||
<caption>Excel 2007 formats
|
||||
</caption>
|
||||
@ -515,7 +512,7 @@ mod tests {
|
||||
</td></tr></tbody></table>
|
||||
"#;
|
||||
|
||||
const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &'static str = r#"
|
||||
const HTML_TABLE_WIKIPEDIA_COLUMNS_AS_ROWS: &str = r#"
|
||||
<table class="infobox vevent">
|
||||
<caption class="infobox-title summary">
|
||||
Microsoft Excel
|
||||
|
@ -4,21 +4,23 @@ description = "A plugin to open files/URLs directly from Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_start"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
glob = "0.3.0"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
open = "1.4.0"
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
url = "2.2.0"
|
||||
webbrowser = "0.5.5"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
open = "1.4.0"
|
||||
|
||||
[build-dependencies]
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
|
@ -4,17 +4,17 @@ description = "Text viewer plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_textview"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-data = { path="../nu-data", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-data = { path="../nu-data", version = "0.40.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
|
||||
bat = { version="0.18", features=["regex-fancy", "paging", "git"] }
|
||||
term_size = "0.3.2"
|
||||
|
@ -36,7 +36,7 @@ pub fn view_text_value(value: &Value) {
|
||||
let config = nu_data::config::config(Tag::unknown())
|
||||
.ok()
|
||||
.and_then(|config| config.get("textview").map(Config::from))
|
||||
.unwrap_or_else(Config::default);
|
||||
.unwrap_or_default();
|
||||
|
||||
if let UntaggedValue::Primitive(Primitive::String(ref s)) = &value.value {
|
||||
let mut printer = bat::PrettyPrinter::new();
|
||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_to_bson"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
bson = "0.14.1"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
bson = { version = "2.0.1", features = [ "chrono-0_4" ] }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
num-traits = "0.2.14"
|
||||
|
||||
[features]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use bson::{encode_document, oid::ObjectId, spec::BinarySubtype, Bson, Document};
|
||||
use bson::{oid::ObjectId, spec::BinarySubtype, Bson, Document};
|
||||
use nu_errors::{CoerceInto, ShellError};
|
||||
use nu_protocol::{
|
||||
Dictionary, Primitive, ReturnSuccess, ReturnValue, SpannedTypeName, UnspannedPathMember,
|
||||
@ -23,17 +23,19 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
||||
Ok(match &v.value {
|
||||
UntaggedValue::Primitive(Primitive::Boolean(b)) => Bson::Boolean(*b),
|
||||
// FIXME: What about really big decimals?
|
||||
UntaggedValue::Primitive(Primitive::Filesize(decimal)) => Bson::FloatingPoint(
|
||||
UntaggedValue::Primitive(Primitive::Filesize(decimal)) => Bson::Double(
|
||||
(decimal)
|
||||
.to_f64()
|
||||
.expect("Unimplemented BUG: What about big decimals?"),
|
||||
),
|
||||
UntaggedValue::Primitive(Primitive::Duration(i)) => Bson::String(i.to_string()),
|
||||
UntaggedValue::Primitive(Primitive::Date(d)) => Bson::UtcDatetime((*d).into()),
|
||||
UntaggedValue::Primitive(Primitive::Date(d)) => {
|
||||
Bson::DateTime(bson::DateTime::from_chrono(*d))
|
||||
}
|
||||
UntaggedValue::Primitive(Primitive::EndOfStream) => Bson::Null,
|
||||
UntaggedValue::Primitive(Primitive::BeginningOfStream) => Bson::Null,
|
||||
UntaggedValue::Primitive(Primitive::Decimal(d)) => {
|
||||
Bson::FloatingPoint(d.to_f64().ok_or_else(|| {
|
||||
Bson::Double(d.to_f64().ok_or_else(|| {
|
||||
ShellError::labeled_error(
|
||||
"Could not convert value to decimal",
|
||||
"could not convert to decimal",
|
||||
@ -41,9 +43,9 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
||||
)
|
||||
})?)
|
||||
}
|
||||
UntaggedValue::Primitive(Primitive::Int(i)) => Bson::I64(*i),
|
||||
UntaggedValue::Primitive(Primitive::Int(i)) => Bson::Int64(*i),
|
||||
UntaggedValue::Primitive(Primitive::BigInt(i)) => {
|
||||
Bson::I64(i.tagged(&v.tag).coerce_into("converting to BSON")?)
|
||||
Bson::Int64(i.tagged(&v.tag).coerce_into("converting to BSON")?)
|
||||
}
|
||||
UntaggedValue::Primitive(Primitive::Nothing) => Bson::Null,
|
||||
UntaggedValue::Primitive(Primitive::String(s)) => Bson::String(s.clone()),
|
||||
@ -51,7 +53,7 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
||||
path.iter()
|
||||
.map(|x| match &x.unspanned {
|
||||
UnspannedPathMember::String(string) => Ok(Bson::String(string.clone())),
|
||||
UnspannedPathMember::Int(int) => Ok(Bson::I64(*int)),
|
||||
UnspannedPathMember::Int(int) => Ok(Bson::Int64(*int)),
|
||||
})
|
||||
.collect::<Result<Vec<Bson>, ShellError>>()?,
|
||||
),
|
||||
@ -66,10 +68,13 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
||||
#[cfg(feature = "dataframe")]
|
||||
UntaggedValue::DataFrame(_) | UntaggedValue::FrameStruct(_) => Bson::Null,
|
||||
UntaggedValue::Error(e) => return Err(e.clone()),
|
||||
UntaggedValue::Primitive(Primitive::Binary(b)) => {
|
||||
Bson::Binary(BinarySubtype::Generic, b.clone())
|
||||
}
|
||||
UntaggedValue::Primitive(Primitive::Binary(b)) => Bson::Binary(bson::Binary {
|
||||
subtype: BinarySubtype::Generic,
|
||||
bytes: b.clone(),
|
||||
}),
|
||||
UntaggedValue::Row(o) => object_value_to_bson(o)?,
|
||||
// TODO Impelmenting Bson::Undefined, Bson::MaxKey, Bson::MinKey and Bson::DbPointer
|
||||
// These Variants weren't present in the previous version.
|
||||
})
|
||||
}
|
||||
|
||||
@ -86,7 +91,9 @@ fn object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
let r: Result<String, _> = tagged_regex_value.try_into();
|
||||
let opts: Result<String, _> = tagged_opts_value.try_into();
|
||||
match (r, opts) {
|
||||
(Ok(r), Ok(opts)) => Ok(Bson::RegExp(r, opts)),
|
||||
(Ok(pattern), Ok(options)) => {
|
||||
Ok(Bson::RegularExpression(bson::Regex { pattern, options }))
|
||||
}
|
||||
_ => generic_object_value_to_bson(o),
|
||||
}
|
||||
}
|
||||
@ -99,9 +106,11 @@ fn object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
let s: Result<&Dictionary, _> = tagged_scope_value.try_into();
|
||||
|
||||
match (js, s) {
|
||||
(Ok(js), Ok(s)) => {
|
||||
if let Bson::Document(doc) = object_value_to_bson(s)? {
|
||||
Ok(Bson::JavaScriptCodeWithScope(js, doc))
|
||||
(Ok(code), Ok(s)) => {
|
||||
if let Bson::Document(scope) = object_value_to_bson(s)? {
|
||||
Ok(Bson::JavaScriptCodeWithScope(
|
||||
bson::JavaScriptCodeWithScope { code, scope },
|
||||
))
|
||||
} else {
|
||||
generic_object_value_to_bson(o)
|
||||
}
|
||||
@ -122,8 +131,11 @@ fn object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
}
|
||||
Some((timestamp, tagged_timestamp_value)) if timestamp == "$timestamp" => {
|
||||
let ts: Result<i64, _> = tagged_timestamp_value.try_into();
|
||||
if let Ok(ts) = ts {
|
||||
Ok(Bson::TimeStamp(ts))
|
||||
if let Ok(time) = ts {
|
||||
Ok(Bson::Timestamp(bson::Timestamp {
|
||||
time: time as u32,
|
||||
increment: Default::default(),
|
||||
}))
|
||||
} else {
|
||||
generic_object_value_to_bson(o)
|
||||
}
|
||||
@ -137,7 +149,10 @@ fn object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
let bin: Result<Vec<u8>, _> = tagged_bin_value.try_into();
|
||||
|
||||
match (bin, bst) {
|
||||
(Ok(bin), Ok(v)) => Ok(Bson::Binary(v, bin)),
|
||||
(Ok(bin), Ok(subtype)) => Ok(Bson::Binary(bson::Binary {
|
||||
subtype,
|
||||
bytes: bin,
|
||||
})),
|
||||
_ => generic_object_value_to_bson(o),
|
||||
}
|
||||
}
|
||||
@ -148,7 +163,7 @@ fn object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
let obj_id: Result<String, _> = tagged_object_id_value.try_into();
|
||||
|
||||
if let Ok(obj_id) = obj_id {
|
||||
let obj_id = ObjectId::with_string(&obj_id);
|
||||
let obj_id = ObjectId::parse_str(&obj_id);
|
||||
|
||||
if let Ok(obj_id) = obj_id {
|
||||
Ok(Bson::ObjectId(obj_id))
|
||||
@ -204,7 +219,7 @@ fn generic_object_value_to_bson(o: &Dictionary) -> Result<Bson, ShellError> {
|
||||
}
|
||||
|
||||
fn shell_encode_document(writer: &mut Vec<u8>, doc: Document, tag: Tag) -> Result<(), ShellError> {
|
||||
match encode_document(writer, &doc) {
|
||||
match doc.to_writer(writer) {
|
||||
Err(e) => Err(ShellError::labeled_error(
|
||||
format!("Failed to encode document due to: {:?}", e),
|
||||
"requires BSON-compatible document",
|
||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the SQLite format for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_to_sqlite"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
hex = "0.4.2"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
nu-source = { path="../nu-source", version = "0.40.0" }
|
||||
tempfile = "3.2.0"
|
||||
|
||||
[dependencies.rusqlite]
|
||||
|
@ -4,16 +4,16 @@ description = "Tree viewer plugin for Nushell"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_tree"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
derive-new = "0.5.8"
|
||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
||||
nu-errors = { path="../nu-errors", version = "0.40.0" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { path="../nu-protocol", version = "0.40.0" }
|
||||
ptree = { version = "0.3.1", default-features = false }
|
||||
|
||||
|
||||
|
@ -4,16 +4,16 @@ description = "Traverses xml"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_xpath"
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
||||
nu-errors = { version = "0.40.0", path="../nu-errors" }
|
||||
nu-plugin = { path="../nu-plugin", version = "0.40.0" }
|
||||
nu-protocol = { version = "0.40.0", path="../nu-protocol" }
|
||||
nu-source = { version = "0.40.0", path="../nu-source" }
|
||||
|
||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||
@ -21,4 +21,4 @@ sxd-document = "0.3.2"
|
||||
sxd-xpath = "0.4.2"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { path="../nu-test-support", version = "0.38.0" }
|
||||
nu-test-support = { path="../nu-test-support", version = "0.40.0" }
|
||||
|
@ -1,36 +1,44 @@
|
||||
# config set
|
||||
|
||||
Sets a value in the config
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
> config set <key> <value> {flags}
|
||||
```
|
||||
> config set <key> <value> {flags}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `<key>` variable name to set
|
||||
* `<value>` value to use
|
||||
|
||||
- `<key>` variable name to set
|
||||
- `<value>` value to use
|
||||
|
||||
## Flags
|
||||
* -h, --help: Display this help message
|
||||
|
||||
- -h, --help: Display this help message
|
||||
|
||||
## Examples
|
||||
Set auto pivoting
|
||||
|
||||
Set auto pivoting
|
||||
|
||||
```shell
|
||||
> config set pivot_mode always
|
||||
```
|
||||
```
|
||||
|
||||
Set line editor options
|
||||
|
||||
Set line editor options
|
||||
```shell
|
||||
> config set line_editor [[edit_mode, completion_type]; [emacs circular]]
|
||||
```
|
||||
```
|
||||
|
||||
Set coloring options
|
||||
|
||||
Set coloring options
|
||||
```shell
|
||||
> config set color_config [[header_align header_bold]; [left $true]]
|
||||
```
|
||||
> config set color_config [[header_align header_color]; [left white_bold]]
|
||||
```
|
||||
|
||||
Set nested options
|
||||
|
||||
Set nested options
|
||||
```shell
|
||||
> config set color_config.header_color white
|
||||
```
|
||||
|
||||
```
|
||||
|
@ -86,7 +86,7 @@ version = "0.4.6"
|
||||
[dependencies.cursive]
|
||||
default-features = false
|
||||
features = ["pancurses-backend"]
|
||||
version = "0.38.0"
|
||||
version = "0.40.0"
|
||||
|
||||
[dependencies.futures-preview]
|
||||
features = ["compat", "io-compat"]
|
||||
|
@ -53,7 +53,6 @@ primitive_binary = "cyan"
|
||||
separator_color = "purple"
|
||||
header_align = "l" # left|l, right|r, center|c
|
||||
header_color = "c" # green|g, red|r, blue|u, black|b, yellow|y, purple|p, cyan|c, white|w
|
||||
header_bold = true
|
||||
index_color = "rd"
|
||||
leading_trailing_space_bg = "white"
|
||||
|
||||
|
Reference in New Issue
Block a user