mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 23:22:10 +02:00
Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
610e3911f6 | |||
ee9eddd851 | |||
c08e145501 | |||
c00853a473 | |||
79c7b20cfd | |||
89cbfd758d | |||
e6e6b730f3 | |||
0fe6a7c1b5 | |||
1794ad51bd | |||
fb197f562a | |||
91c270c14a | |||
3e93ae8af4 | |||
e06df124ca | |||
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
|
|
167
.github/workflows/release.yml
vendored
167
.github/workflows/release.yml
vendored
@ -1,8 +1,9 @@
|
|||||||
name: Create Release Draft
|
name: Create Release Draft
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
tags: ['[0-9]+.[0-9]+.[0-9]+*']
|
tags: ["[0-9]+.[0-9]+.[0-9]+*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
@ -28,6 +29,60 @@ jobs:
|
|||||||
command: build
|
command: build
|
||||||
args: --release --all --features=extra
|
args: --release --all --features=extra
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu)
|
||||||
|
# run: strip target/release/nu
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_inc)
|
||||||
|
# run: strip target/release/nu_plugin_inc
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_match)
|
||||||
|
# run: strip target/release/nu_plugin_match
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_textview)
|
||||||
|
# run: strip target/release/nu_plugin_textview
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_binaryview)
|
||||||
|
# run: strip target/release/nu_plugin_binaryview
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_bar)
|
||||||
|
# run: strip target/release/nu_plugin_chart_bar
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_line)
|
||||||
|
# run: strip target/release/nu_plugin_chart_line
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_bson)
|
||||||
|
# run: strip target/release/nu_plugin_from_bson
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_sqlite)
|
||||||
|
# run: strip target/release/nu_plugin_from_sqlite
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_mp4)
|
||||||
|
# run: strip target/release/nu_plugin_from_mp4
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_query_json)
|
||||||
|
# run: strip target/release/nu_plugin_query_json
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_s3)
|
||||||
|
# run: strip target/release/nu_plugin_s3
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_selector)
|
||||||
|
# run: strip target/release/nu_plugin_selector
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_start)
|
||||||
|
# run: strip target/release/nu_plugin_start
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_bson)
|
||||||
|
# run: strip target/release/nu_plugin_to_bson
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_sqlite)
|
||||||
|
# run: strip target/release/nu_plugin_to_sqlite
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_tree)
|
||||||
|
# run: strip target/release/nu_plugin_tree
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_xpath)
|
||||||
|
# run: strip target/release/nu_plugin_xpath
|
||||||
|
|
||||||
- name: Create output directory
|
- name: Create output directory
|
||||||
run: mkdir output
|
run: mkdir output
|
||||||
|
|
||||||
@ -70,6 +125,60 @@ jobs:
|
|||||||
command: build
|
command: build
|
||||||
args: --release --all --features=extra
|
args: --release --all --features=extra
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu)
|
||||||
|
# run: strip target/release/nu
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_inc)
|
||||||
|
# run: strip target/release/nu_plugin_inc
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_match)
|
||||||
|
# run: strip target/release/nu_plugin_match
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_textview)
|
||||||
|
# run: strip target/release/nu_plugin_textview
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_binaryview)
|
||||||
|
# run: strip target/release/nu_plugin_binaryview
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_bar)
|
||||||
|
# run: strip target/release/nu_plugin_chart_bar
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_line)
|
||||||
|
# run: strip target/release/nu_plugin_chart_line
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_bson)
|
||||||
|
# run: strip target/release/nu_plugin_from_bson
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_sqlite)
|
||||||
|
# run: strip target/release/nu_plugin_from_sqlite
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_mp4)
|
||||||
|
# run: strip target/release/nu_plugin_from_mp4
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_query_json)
|
||||||
|
# run: strip target/release/nu_plugin_query_json
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_s3)
|
||||||
|
# run: strip target/release/nu_plugin_s3
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_selector)
|
||||||
|
# run: strip target/release/nu_plugin_selector
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_start)
|
||||||
|
# run: strip target/release/nu_plugin_start
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_bson)
|
||||||
|
# run: strip target/release/nu_plugin_to_bson
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_sqlite)
|
||||||
|
# run: strip target/release/nu_plugin_to_sqlite
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_tree)
|
||||||
|
# run: strip target/release/nu_plugin_tree
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_xpath)
|
||||||
|
# run: strip target/release/nu_plugin_xpath
|
||||||
|
|
||||||
- name: Create output directory
|
- name: Create output directory
|
||||||
run: mkdir output
|
run: mkdir output
|
||||||
|
|
||||||
@ -114,6 +223,60 @@ jobs:
|
|||||||
command: build
|
command: build
|
||||||
args: --release --all --features=extra
|
args: --release --all --features=extra
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu.exe)
|
||||||
|
# run: strip target/release/nu.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_inc.exe)
|
||||||
|
# run: strip target/release/nu_plugin_inc.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_match.exe)
|
||||||
|
# run: strip target/release/nu_plugin_match.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_textview.exe)
|
||||||
|
# run: strip target/release/nu_plugin_textview.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_binaryview.exe)
|
||||||
|
# run: strip target/release/nu_plugin_binaryview.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_bar.exe)
|
||||||
|
# run: strip target/release/nu_plugin_chart_bar.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_chart_line.exe)
|
||||||
|
# run: strip target/release/nu_plugin_chart_line.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_bson.exe)
|
||||||
|
# run: strip target/release/nu_plugin_from_bson.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_sqlite.exe)
|
||||||
|
# run: strip target/release/nu_plugin_from_sqlite.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_from_mp4.exe)
|
||||||
|
# run: strip target/release/nu_plugin_from_mp4.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_query_json.exe)
|
||||||
|
# run: strip target/release/nu_plugin_query_json.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_s3.exe)
|
||||||
|
# run: strip target/release/nu_plugin_s3.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_selector.exe)
|
||||||
|
# run: strip target/release/nu_plugin_selector.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_start.exe)
|
||||||
|
# run: strip target/release/nu_plugin_start.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_bson.exe)
|
||||||
|
# run: strip target/release/nu_plugin_to_bson.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_to_sqlite.exe)
|
||||||
|
# run: strip target/release/nu_plugin_to_sqlite.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_tree.exe)
|
||||||
|
# run: strip target/release/nu_plugin_tree.exe
|
||||||
|
|
||||||
|
# - name: Strip binaries (nu_plugin_xpath.exe)
|
||||||
|
# run: strip target/release/nu_plugin_xpath.exe
|
||||||
|
|
||||||
- name: Create output directory
|
- name: Create output directory
|
||||||
run: mkdir output
|
run: mkdir output
|
||||||
|
|
||||||
@ -274,7 +437,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: windows-installer
|
name: windows-installer
|
||||||
path: ./
|
path: ./
|
||||||
|
|
||||||
- name: Upload Windows installer
|
- name: Upload Windows installer
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
|
11
.github/workflows/stale.yml
vendored
11
.github/workflows/stale.yml
vendored
@ -19,11 +19,10 @@ jobs:
|
|||||||
operations-per-run: 520
|
operations-per-run: 520
|
||||||
enable-statistics: true
|
enable-statistics: true
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
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.'
|
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.'
|
||||||
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-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.'
|
||||||
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.'
|
|
||||||
days-before-issue-stale: 90
|
days-before-issue-stale: 90
|
||||||
days-before-pr-stale: 45
|
days-before-pr-stale: 45
|
||||||
days-before-issue-close: 10
|
days-before-issue-close: 100000
|
||||||
days-before-pr-close: 10
|
days-before-pr-close: 100
|
||||||
|
exempt-issue-labels: 'exempt,keep'
|
||||||
|
1351
Cargo.lock
generated
1351
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
60
Cargo.toml
60
Cargo.toml
@ -10,7 +10,7 @@ license = "MIT"
|
|||||||
name = "nu"
|
name = "nu"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/nushell/nushell"
|
repository = "https://github.com/nushell/nushell"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["crates/*/"]
|
members = ["crates/*/"]
|
||||||
@ -18,34 +18,34 @@ members = ["crates/*/"]
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-cli = { version = "0.38.0", path="./crates/nu-cli", default-features=false }
|
nu-cli = { version = "0.41.0", path="./crates/nu-cli", default-features=false }
|
||||||
nu-command = { version = "0.38.0", path="./crates/nu-command" }
|
nu-command = { version = "0.41.0", path="./crates/nu-command" }
|
||||||
nu-completion = { version = "0.38.0", path="./crates/nu-completion" }
|
nu-completion = { version = "0.41.0", path="./crates/nu-completion" }
|
||||||
nu-data = { version = "0.38.0", path="./crates/nu-data" }
|
nu-data = { version = "0.41.0", path="./crates/nu-data" }
|
||||||
nu-engine = { version = "0.38.0", path="./crates/nu-engine" }
|
nu-engine = { version = "0.41.0", path="./crates/nu-engine" }
|
||||||
nu-errors = { version = "0.38.0", path="./crates/nu-errors" }
|
nu-errors = { version = "0.41.0", path="./crates/nu-errors" }
|
||||||
nu-parser = { version = "0.38.0", path="./crates/nu-parser" }
|
nu-parser = { version = "0.41.0", path="./crates/nu-parser" }
|
||||||
nu-path = { version = "0.38.0", path="./crates/nu-path" }
|
nu-path = { version = "0.41.0", path="./crates/nu-path" }
|
||||||
nu-plugin = { version = "0.38.0", path="./crates/nu-plugin" }
|
nu-plugin = { version = "0.41.0", path="./crates/nu-plugin" }
|
||||||
nu-protocol = { version = "0.38.0", path="./crates/nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="./crates/nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="./crates/nu-source" }
|
nu-source = { version = "0.41.0", path="./crates/nu-source" }
|
||||||
nu-value-ext = { version = "0.38.0", path="./crates/nu-value-ext" }
|
nu-value-ext = { version = "0.41.0", path="./crates/nu-value-ext" }
|
||||||
|
|
||||||
nu_plugin_binaryview = { version = "0.38.0", path="./crates/nu_plugin_binaryview", optional=true }
|
nu_plugin_binaryview = { version = "0.41.0", path="./crates/nu_plugin_binaryview", optional=true }
|
||||||
nu_plugin_chart = { version = "0.38.0", path="./crates/nu_plugin_chart", optional=true }
|
nu_plugin_chart = { version = "0.41.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_bson = { version = "0.41.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_from_sqlite = { version = "0.41.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_inc = { version = "0.41.0", path="./crates/nu_plugin_inc", optional=true }
|
||||||
nu_plugin_match = { version = "0.38.0", path="./crates/nu_plugin_match", optional=true }
|
nu_plugin_match = { version = "0.41.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_query_json = { version = "0.41.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_s3 = { version = "0.41.0", path="./crates/nu_plugin_s3", optional=true }
|
||||||
nu_plugin_selector = { version = "0.38.0", path="./crates/nu_plugin_selector", optional=true }
|
nu_plugin_selector = { version = "0.41.0", path="./crates/nu_plugin_selector", optional=true }
|
||||||
nu_plugin_start = { version = "0.38.0", path="./crates/nu_plugin_start", optional=true }
|
nu_plugin_start = { version = "0.41.0", path="./crates/nu_plugin_start", optional=true }
|
||||||
nu_plugin_textview = { version = "0.38.0", path="./crates/nu_plugin_textview", optional=true }
|
nu_plugin_textview = { version = "0.41.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_bson = { version = "0.41.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_to_sqlite = { version = "0.41.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_tree = { version = "0.41.0", path="./crates/nu_plugin_tree", optional=true }
|
||||||
nu_plugin_xpath = { version = "0.38.0", path="./crates/nu_plugin_xpath", optional=true }
|
nu_plugin_xpath = { version = "0.41.0", path="./crates/nu_plugin_xpath", optional=true }
|
||||||
|
|
||||||
# Required to bootstrap the main binary
|
# Required to bootstrap the main binary
|
||||||
ctrlc = { version="3.1.7", optional=true }
|
ctrlc = { version="3.1.7", optional=true }
|
||||||
@ -53,7 +53,7 @@ futures = { version="0.3.12", features=["compat", "io-compat"] }
|
|||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
nu-test-support = { version = "0.38.0", path="./crates/nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="./crates/nu-test-support" }
|
||||||
serial_test = "0.5.1"
|
serial_test = "0.5.1"
|
||||||
hamcrest2 = "0.3.0"
|
hamcrest2 = "0.3.0"
|
||||||
rstest = "0.10.0"
|
rstest = "0.10.0"
|
||||||
@ -89,7 +89,6 @@ extra = [
|
|||||||
"inc",
|
"inc",
|
||||||
"tree",
|
"tree",
|
||||||
"textview",
|
"textview",
|
||||||
"clipboard-cli",
|
|
||||||
"trash-support",
|
"trash-support",
|
||||||
"uuid-support",
|
"uuid-support",
|
||||||
"start",
|
"start",
|
||||||
@ -113,7 +112,6 @@ textview = ["nu_plugin_textview"]
|
|||||||
binaryview = ["nu_plugin_binaryview"]
|
binaryview = ["nu_plugin_binaryview"]
|
||||||
bson = ["nu_plugin_from_bson", "nu_plugin_to_bson"]
|
bson = ["nu_plugin_from_bson", "nu_plugin_to_bson"]
|
||||||
chart = ["nu_plugin_chart"]
|
chart = ["nu_plugin_chart"]
|
||||||
clipboard-cli = ["nu-command/clipboard-cli"]
|
|
||||||
query-json = ["nu_plugin_query_json"]
|
query-json = ["nu_plugin_query_json"]
|
||||||
s3 = ["nu_plugin_s3"]
|
s3 = ["nu_plugin_s3"]
|
||||||
selector = ["nu_plugin_selector"]
|
selector = ["nu_plugin_selector"]
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
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):
|
To install Nu via the [Windows Package Manager](https://aka.ms/winget-cli):
|
||||||
|
|
||||||
```shell
|
```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:
|
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:
|
||||||
|
@ -10,4 +10,4 @@ Foundational libraries are split into two kinds of crates:
|
|||||||
Plugins are likewise also split into two types:
|
Plugins are likewise also split into two types:
|
||||||
|
|
||||||
* Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
|
* Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
|
||||||
* Extra plugins - these plugins run a wide range of differnt capabilities like working with different file types, charting, viewing binary data, and more.
|
* Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.
|
||||||
|
@ -9,7 +9,7 @@ description = "Library for ANSI terminal colors and styles (bold, underline)"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
@ -613,7 +613,7 @@ mod serde_json_tests {
|
|||||||
let serialized = serde_json::to_string(&color).unwrap();
|
let serialized = serde_json::to_string(&color).unwrap();
|
||||||
let deserialized: Color = serde_json::from_str(&serialized).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"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-cli"
|
name = "nu-cli"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-completion = { version = "0.38.0", path="../nu-completion" }
|
nu-completion = { version = "0.41.0", path="../nu-completion" }
|
||||||
nu-command = { version = "0.38.0", path="../nu-command" }
|
nu-command = { version = "0.41.0", path="../nu-command" }
|
||||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
nu-data = { version = "0.41.0", path="../nu-data" }
|
||||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
nu-engine = { version = "0.41.0", path="../nu-engine" }
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
nu-parser = { version = "0.41.0", path="../nu-parser" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
nu-stream = { version = "0.41.0", path="../nu-stream" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
|
|
||||||
indexmap ="1.6.1"
|
indexmap ="1.6.1"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
@ -29,13 +29,13 @@ pretty_env_logger = "0.4.0"
|
|||||||
strip-ansi-escapes = "0.1.0"
|
strip-ansi-escapes = "0.1.0"
|
||||||
rustyline = { version="9.0.0", optional=true }
|
rustyline = { version="9.0.0", optional=true }
|
||||||
ctrlc = { version="3.1.7", optional=true }
|
ctrlc = { version="3.1.7", optional=true }
|
||||||
shadow-rs = { version="0.6", default-features=false, optional=true }
|
shadow-rs = { version = "0.8.1", default-features = false, optional = true }
|
||||||
serde = { version="1.0.123", features=["derive"] }
|
serde = { version="1.0.123", features=["derive"] }
|
||||||
serde_yaml = "0.8.16"
|
serde_yaml = "0.8.16"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
shadow-rs = "0.6"
|
shadow-rs = "0.8.1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["shadow-rs"]
|
default = ["shadow-rs"]
|
||||||
|
@ -513,11 +513,6 @@ mod tests {
|
|||||||
let args = format!("nu --loglevel={}", level);
|
let args = format!("nu --loglevel={}", level);
|
||||||
ui.parse(&args)?;
|
ui.parse(&args)?;
|
||||||
assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
|
assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
|
||||||
|
|
||||||
let ui = cli_app();
|
|
||||||
let args = format!("nu -l {}", level);
|
|
||||||
ui.parse(&args)?;
|
|
||||||
assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let ui = cli_app();
|
let ui = cli_app();
|
||||||
@ -530,6 +525,17 @@ mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_be_login() -> Result<(), ShellError> {
|
||||||
|
let ui = cli_app();
|
||||||
|
ui.parse("nu -l")?;
|
||||||
|
|
||||||
|
let ui = cli_app();
|
||||||
|
ui.parse("nu --login")?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_be_passed_nu_scripts() -> Result<(), ShellError> {
|
fn can_be_passed_nu_scripts() -> Result<(), ShellError> {
|
||||||
let ui = cli_app();
|
let ui = cli_app();
|
||||||
|
@ -372,7 +372,7 @@ pub fn cli(
|
|||||||
LineResult::ClearHistory => {
|
LineResult::ClearHistory => {
|
||||||
if options.save_history {
|
if options.save_history {
|
||||||
rl.clear_history();
|
rl.clear_history();
|
||||||
let _ = rl.append_history(&history_path);
|
std::fs::remove_file(&history_path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,35 +5,34 @@ description = "CLI for nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-command"
|
name = "nu-command"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
nu-data = { version = "0.41.0", path="../nu-data" }
|
||||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
nu-engine = { version = "0.41.0", path="../nu-engine" }
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-json = { version = "0.38.0", path="../nu-json" }
|
nu-json = { version = "0.41.0", path="../nu-json" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
nu-parser = { version = "0.41.0", path="../nu-parser" }
|
||||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
nu-plugin = { version = "0.41.0", path="../nu-plugin" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-serde = { version = "0.38.0", path="../nu-serde" }
|
nu-serde = { version = "0.41.0", path="../nu-serde" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
nu-stream = { version = "0.41.0", path="../nu-stream" }
|
||||||
nu-table = { version = "0.38.0", path="../nu-table" }
|
nu-table = { version = "0.41.0", path="../nu-table" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
nu-value-ext = { version = "0.41.0", path="../nu-value-ext" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
nu-pretty-hex = { version = "0.38.0", path="../nu-pretty-hex" }
|
nu-pretty-hex = { version = "0.41.0", path="../nu-pretty-hex" }
|
||||||
|
|
||||||
url = "2.2.1"
|
url = "2.2.1"
|
||||||
mime = "0.3.16"
|
mime = "0.3.16"
|
||||||
Inflector = "0.11"
|
Inflector = "0.11"
|
||||||
arboard = { version="1.1.0", optional=true }
|
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { version = "0.3.0", features = ["serde"] }
|
||||||
calamine = "0.18.0"
|
calamine = "0.18.0"
|
||||||
chrono = { version="0.4.19", features=["serde"] }
|
chrono = { version="0.4.19", features=["serde"] }
|
||||||
chrono-tz = "0.5.3"
|
chrono-tz = "0.5.3"
|
||||||
@ -56,7 +55,7 @@ lazy_static = "1.*"
|
|||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
md-5 = "0.9.1"
|
md-5 = "0.9.1"
|
||||||
meval = "0.2.0"
|
meval = "0.2.0"
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
num-format = { version="0.4.0", features=["with-num-bigint"] }
|
num-format = { version="0.4.0", features=["with-num-bigint"] }
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
parking_lot = "0.11.1"
|
parking_lot = "0.11.1"
|
||||||
@ -74,14 +73,14 @@ serde_urlencoded = "0.7.0"
|
|||||||
serde_yaml = "0.8.16"
|
serde_yaml = "0.8.16"
|
||||||
sha2 = "0.9.3"
|
sha2 = "0.9.3"
|
||||||
strip-ansi-escapes = "0.1.0"
|
strip-ansi-escapes = "0.1.0"
|
||||||
sysinfo = { version = "0.20.2", optional = true }
|
sysinfo = { version = "0.21.1", optional = true }
|
||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
term = { version="0.7.0", optional=true }
|
term = { version="0.7.0", optional=true }
|
||||||
term_size = "0.3.2"
|
term_size = "0.3.2"
|
||||||
titlecase = "1.1.0"
|
titlecase = "1.1.0"
|
||||||
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
|
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
trash = { version="1.3.0", optional=true }
|
trash = { version = "2.0.2", optional = true }
|
||||||
unicode-segmentation = "1.8"
|
unicode-segmentation = "1.8"
|
||||||
uuid_crate = { package="uuid", version="0.8.2", features=["v4"], optional=true }
|
uuid_crate = { package="uuid", version="0.8.2", features=["v4"], optional=true }
|
||||||
which = { version="4.1.0", optional=true }
|
which = { version="4.1.0", optional=true }
|
||||||
@ -89,9 +88,10 @@ zip = { version="0.5.9", optional=true }
|
|||||||
digest = "0.9.0"
|
digest = "0.9.0"
|
||||||
|
|
||||||
[dependencies.polars]
|
[dependencies.polars]
|
||||||
version = "0.16.0"
|
version = "0.17.0"
|
||||||
optional = true
|
optional = true
|
||||||
features = ["parquet", "json", "random", "pivot", "strings", "is_in", "temporal", "cum_agg", "rolling_window"]
|
default-features = false
|
||||||
|
features = ["docs", "zip_with", "csv-file", "temporal", "performant", "pretty_fmt", "dtype-slim", "parquet", "json", "random", "pivot", "strings", "is_in", "cum_agg", "rolling_window"]
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
umask = "1.0.0"
|
umask = "1.0.0"
|
||||||
@ -104,7 +104,7 @@ users = "0.11.0"
|
|||||||
# num-format = { version = "0.4", features = ["with-system-locale"] }
|
# num-format = { version = "0.4", features = ["with-system-locale"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
shadow-rs = "0.6"
|
shadow-rs = "0.8.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
quickcheck = "1.0.3"
|
quickcheck = "1.0.3"
|
||||||
@ -112,7 +112,6 @@ quickcheck_macros = "1.0.0"
|
|||||||
hamcrest2 = "0.3.0"
|
hamcrest2 = "0.3.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
clipboard-cli = ["arboard"]
|
|
||||||
rustyline-support = ["rustyline"]
|
rustyline-support = ["rustyline"]
|
||||||
stable = []
|
stable = []
|
||||||
trash-support = ["trash"]
|
trash-support = ["trash"]
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
use derive_new::new;
|
|
||||||
use nu_protocol::hir;
|
|
||||||
|
|
||||||
#[derive(new, Debug)]
|
|
||||||
pub(crate) struct Command {
|
|
||||||
pub(crate) args: hir::Call,
|
|
||||||
}
|
|
@ -1,8 +1,10 @@
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
use nu_engine::{evaluate_baseline_expr, BufCodecReader};
|
use nu_engine::{evaluate_baseline_expr, BufCodecReader};
|
||||||
use nu_engine::{MaybeTextCodec, StringOrBinary};
|
use nu_engine::{MaybeTextCodec, StringOrBinary};
|
||||||
use nu_test_support::NATIVE_PATH_ENV_VAR;
|
use nu_test_support::NATIVE_PATH_ENV_VAR;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
use std::env;
|
use std::env;
|
||||||
@ -44,20 +46,16 @@ pub(crate) fn run_external_command(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
fn trim_double_quotes(input: &str) -> String {
|
fn trim_enclosing_quotes(input: &str) -> String {
|
||||||
let mut chars = input.chars();
|
let mut chars = input.chars();
|
||||||
|
|
||||||
match (chars.next(), chars.next_back()) {
|
match (chars.next(), chars.next_back()) {
|
||||||
(Some('"'), Some('"')) => chars.collect(),
|
(Some('"'), Some('"')) => chars.collect(),
|
||||||
|
(Some('\''), Some('\'')) => chars.collect(),
|
||||||
_ => input.to_string(),
|
_ => input.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
fn escape_where_needed(input: &str) -> String {
|
|
||||||
input.split(' ').join("\\ ").split('\'').join("\\'")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_with_stdin(
|
fn run_with_stdin(
|
||||||
command: ExternalCommand,
|
command: ExternalCommand,
|
||||||
context: &mut EvaluationContext,
|
context: &mut EvaluationContext,
|
||||||
@ -115,15 +113,9 @@ fn run_with_stdin(
|
|||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
{
|
{
|
||||||
if !_is_literal {
|
if !_is_literal {
|
||||||
let escaped = escape_double_quotes(&arg);
|
arg
|
||||||
add_double_quotes(&escaped)
|
|
||||||
} else {
|
} else {
|
||||||
let trimmed = trim_double_quotes(&arg);
|
trim_enclosing_quotes(&arg)
|
||||||
if trimmed != arg {
|
|
||||||
escape_where_needed(&trimmed)
|
|
||||||
} else {
|
|
||||||
trimmed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
@ -131,7 +123,7 @@ fn run_with_stdin(
|
|||||||
if let Some(unquoted) = remove_quotes(&arg) {
|
if let Some(unquoted) = remove_quotes(&arg) {
|
||||||
unquoted.to_string()
|
unquoted.to_string()
|
||||||
} else {
|
} else {
|
||||||
arg.to_string()
|
arg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -172,9 +164,29 @@ fn spawn_cmd_command(command: &ExternalCommand, args: &[String]) -> Command {
|
|||||||
process
|
process
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_unsafe_shell_characters(arg: &str) -> bool {
|
||||||
|
lazy_static! {
|
||||||
|
static ref RE: Regex = Regex::new(r"[^\w@%+=:,./-]").expect("regex to be valid");
|
||||||
|
}
|
||||||
|
|
||||||
|
RE.is_match(arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn shell_arg_escape(arg: &str) -> String {
|
||||||
|
match arg {
|
||||||
|
"" => String::from("''"),
|
||||||
|
s if !has_unsafe_shell_characters(s) => String::from(s),
|
||||||
|
_ => {
|
||||||
|
let single_quotes_escaped = arg.split('\'').join("'\"'\"'");
|
||||||
|
format!("'{}'", single_quotes_escaped)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Spawn a sh command with `sh -c args...`
|
/// Spawn a sh command with `sh -c args...`
|
||||||
fn spawn_sh_command(command: &ExternalCommand, args: &[String]) -> Command {
|
fn spawn_sh_command(command: &ExternalCommand, args: &[String]) -> Command {
|
||||||
let cmd_with_args = vec![command.name.clone(), args.join(" ")].join(" ");
|
let joined_and_escaped_arguments = args.iter().map(|arg| shell_arg_escape(arg)).join(" ");
|
||||||
|
let cmd_with_args = vec![command.name.clone(), joined_and_escaped_arguments].join(" ");
|
||||||
let mut process = Command::new("sh");
|
let mut process = Command::new("sh");
|
||||||
process.arg("-c").arg(cmd_with_args);
|
process.arg("-c").arg(cmd_with_args);
|
||||||
process
|
process
|
||||||
|
@ -1,5 +1 @@
|
|||||||
mod dynamic;
|
|
||||||
pub(crate) mod external;
|
pub(crate) mod external;
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub(crate) use dynamic::Command as DynamicCommand;
|
|
||||||
|
@ -38,7 +38,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Set coloring options",
|
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,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
|
@ -15,6 +15,7 @@ impl WholeStreamCommand for Command {
|
|||||||
.switch("skip-plugins", "do not load plugins", None)
|
.switch("skip-plugins", "do not load plugins", None)
|
||||||
.switch("no-history", "don't save history", None)
|
.switch("no-history", "don't save history", None)
|
||||||
.switch("perf", "show startup performance metrics", None)
|
.switch("perf", "show startup performance metrics", None)
|
||||||
|
.switch("login", "start Nu as if it was a login shell", Some('l'))
|
||||||
.named(
|
.named(
|
||||||
"commands",
|
"commands",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
@ -33,7 +34,7 @@ impl WholeStreamCommand for Command {
|
|||||||
"loglevel",
|
"loglevel",
|
||||||
SyntaxShape::String,
|
SyntaxShape::String,
|
||||||
"LEVEL: error, warn, info, debug, trace",
|
"LEVEL: error, warn, info, debug, trace",
|
||||||
Some('l'),
|
None,
|
||||||
)
|
)
|
||||||
.named(
|
.named(
|
||||||
"config-file",
|
"config-file",
|
||||||
|
@ -221,11 +221,6 @@ fn features_enabled() -> Vec<String> {
|
|||||||
names.push("zip".to_string());
|
names.push("zip".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
{
|
|
||||||
names.push("clipboard-cli".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "trash-support")]
|
#[cfg(feature = "trash-support")]
|
||||||
{
|
{
|
||||||
names.push("trash".to_string());
|
names.push("trash".to_string());
|
||||||
|
@ -121,7 +121,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
let tail = df.as_ref().get_columns().iter().map(|col| {
|
let tail = df.as_ref().get_columns().iter().map(|col| {
|
||||||
let count = col.len() as f64;
|
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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -144,7 +144,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
_ => None,
|
_ => 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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -153,7 +153,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let q_25 = match col.quantile_as_series(0.25) {
|
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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -164,7 +164,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let q_50 = match col.quantile_as_series(0.50) {
|
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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -175,7 +175,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let q_75 = match col.quantile_as_series(0.75) {
|
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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -185,7 +185,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
Err(_) => None,
|
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) {
|
Ok(ca) => match ca.get(0) {
|
||||||
AnyValue::Float64(v) => Some(v),
|
AnyValue::Float64(v) => Some(v),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -44,6 +44,12 @@ impl WholeStreamCommand for DataFrame {
|
|||||||
"type of join. Inner by default",
|
"type of join. Inner by default",
|
||||||
Some('t'),
|
Some('t'),
|
||||||
)
|
)
|
||||||
|
.named(
|
||||||
|
"suffix",
|
||||||
|
SyntaxShape::String,
|
||||||
|
"suffix for the columns of the right dataframe",
|
||||||
|
Some('s'),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
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 r_df: Value = args.req(0)?;
|
||||||
let l_col: Vec<Value> = args.req_named("left")?;
|
let l_col: Vec<Value> = args.req_named("left")?;
|
||||||
let r_col: Vec<Value> = args.req_named("right")?;
|
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_op: Option<Tagged<String>> = args.get_flag("type")?;
|
||||||
|
|
||||||
let join_type = match join_type_op {
|
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 (l_col_string, l_col_span) = convert_columns(&l_col, &tag)?;
|
||||||
let (r_col_string, r_col_span) = convert_columns(&r_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()
|
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))
|
.map_err(|e| parse_polars_error::<&str>(&e, &l_col_span, None))
|
||||||
}
|
}
|
||||||
_ => Err(ShellError::labeled_error(
|
_ => 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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.day().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.hour().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.minute().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.month().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.nanosecond().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.ordinal().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.second().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.week().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.weekday().into_series();
|
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 series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.year().into_series();
|
let res = casted.year().into_series();
|
||||||
|
@ -6,7 +6,7 @@ use nu_protocol::{
|
|||||||
Signature, SyntaxShape, UntaggedValue,
|
Signature, SyntaxShape, UntaggedValue,
|
||||||
};
|
};
|
||||||
use nu_source::Tagged;
|
use nu_source::Tagged;
|
||||||
use polars::prelude::DataType;
|
use polars::prelude::{DataType, RollingOptions};
|
||||||
|
|
||||||
enum RollType {
|
enum RollType {
|
||||||
Min,
|
Min,
|
||||||
@ -57,7 +57,6 @@ impl WholeStreamCommand for DataFrame {
|
|||||||
Signature::build("dataframe rolling")
|
Signature::build("dataframe rolling")
|
||||||
.required("type", SyntaxShape::String, "rolling operation")
|
.required("type", SyntaxShape::String, "rolling operation")
|
||||||
.required("window", SyntaxShape::Int, "Window size for rolling")
|
.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> {
|
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 tag = args.call_info.name_tag.clone();
|
||||||
let roll_type: Tagged<String> = args.req(0)?;
|
let roll_type: Tagged<String> = args.req(0)?;
|
||||||
let window_size: Tagged<i64> = args.req(1)?;
|
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 (df, df_tag) = NuDataFrame::try_from_stream(&mut args.input, &tag.span)?;
|
||||||
let series = df.as_series(&df_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 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 {
|
let res = match roll_type {
|
||||||
RollType::Max => series.rolling_max(
|
RollType::Max => series.rolling_max(rolling_opts),
|
||||||
window_size.item as u32,
|
RollType::Min => series.rolling_min(rolling_opts),
|
||||||
None,
|
RollType::Sum => series.rolling_sum(rolling_opts),
|
||||||
ignore_nulls,
|
RollType::Mean => series.rolling_mean(rolling_opts),
|
||||||
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,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut res = res.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
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() {
|
let casted = match indices.dtype() {
|
||||||
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => indices
|
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => indices
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.cast_with_dtype(&DataType::UInt32)
|
.cast(&DataType::UInt32)
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
||||||
_ => Err(ShellError::labeled_error_with_secondary(
|
_ => Err(ShellError::labeled_error_with_secondary(
|
||||||
"Incorrect type",
|
"Incorrect type",
|
||||||
|
@ -58,7 +58,7 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
let series = df.as_series(&df_tag.span)?;
|
let series = df.as_series(&df_tag.span)?;
|
||||||
|
|
||||||
let casted = series
|
let casted = series
|
||||||
.date64()
|
.datetime()
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
.map_err(|e| parse_polars_error::<&str>(&e, &df_tag.span, None))?;
|
||||||
|
|
||||||
let res = casted.strftime(&fmt.item).into_series();
|
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() {
|
let casted = match series.dtype() {
|
||||||
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => series
|
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => series
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.cast_with_dtype(&DataType::UInt32)
|
.cast(&DataType::UInt32)
|
||||||
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
.map_err(|e| parse_polars_error::<&str>(&e, &value.tag.span, None)),
|
||||||
_ => Err(ShellError::labeled_error_with_secondary(
|
_ => Err(ShellError::labeled_error_with_secondary(
|
||||||
"Incorrect type",
|
"Incorrect type",
|
||||||
|
@ -73,9 +73,9 @@ fn command(mut args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||||||
let writer = CsvWriter::new(&mut file);
|
let writer = CsvWriter::new(&mut file);
|
||||||
|
|
||||||
let writer = if no_header {
|
let writer = if no_header {
|
||||||
writer.has_headers(false)
|
writer.has_header(false)
|
||||||
} else {
|
} else {
|
||||||
writer.has_headers(true)
|
writer.has_header(true)
|
||||||
};
|
};
|
||||||
|
|
||||||
let writer = match delimiter {
|
let writer = match delimiter {
|
||||||
|
@ -11,12 +11,6 @@ use nu_protocol::{
|
|||||||
|
|
||||||
pub struct WithEnv;
|
pub struct WithEnv;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
struct WithEnvArgs {
|
|
||||||
variable: Value,
|
|
||||||
block: CapturedBlock,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WholeStreamCommand for WithEnv {
|
impl WholeStreamCommand for WithEnv {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"with-env"
|
"with-env"
|
||||||
|
@ -163,7 +163,7 @@ fn get_current_date() -> (i32, u32, u32) {
|
|||||||
|
|
||||||
fn add_months_of_year_to_table(
|
fn add_months_of_year_to_table(
|
||||||
args: &CommandArgs,
|
args: &CommandArgs,
|
||||||
mut calendar_vec_deque: &mut VecDeque<Value>,
|
calendar_vec_deque: &mut VecDeque<Value>,
|
||||||
tag: &Tag,
|
tag: &Tag,
|
||||||
selected_year: i32,
|
selected_year: i32,
|
||||||
(start_month, end_month): (u32, u32),
|
(start_month, end_month): (u32, u32),
|
||||||
@ -181,7 +181,7 @@ fn add_months_of_year_to_table(
|
|||||||
|
|
||||||
let add_month_to_table_result = add_month_to_table(
|
let add_month_to_table_result = add_month_to_table(
|
||||||
args,
|
args,
|
||||||
&mut calendar_vec_deque,
|
calendar_vec_deque,
|
||||||
tag,
|
tag,
|
||||||
selected_year,
|
selected_year,
|
||||||
month_number,
|
month_number,
|
||||||
|
@ -170,7 +170,7 @@ fn action(
|
|||||||
Ok(UntaggedValue::string(gradient_string).into_value(tag))
|
Ok(UntaggedValue::string(gradient_string).into_value(tag))
|
||||||
}
|
}
|
||||||
(None, Some(fg_end), None, Some(bg_end)) => {
|
(None, Some(fg_end), None, Some(bg_end)) => {
|
||||||
// missin fg_start and bg_start, so assume black
|
// missing fg_start and bg_start, so assume black
|
||||||
let fg_start = Rgb::new(0, 0, 0);
|
let fg_start = Rgb::new(0, 0, 0);
|
||||||
let bg_start = Rgb::new(0, 0, 0);
|
let bg_start = Rgb::new(0, 0, 0);
|
||||||
let fg_gradient = Gradient::new(fg_start, fg_end);
|
let fg_gradient = Gradient::new(fg_start, fg_end);
|
||||||
|
@ -1,105 +0,0 @@
|
|||||||
use crate::prelude::*;
|
|
||||||
|
|
||||||
use nu_engine::WholeStreamCommand;
|
|
||||||
use nu_errors::ShellError;
|
|
||||||
use nu_protocol::{Signature, Value};
|
|
||||||
|
|
||||||
use arboard::Clipboard;
|
|
||||||
|
|
||||||
pub struct Clip;
|
|
||||||
|
|
||||||
impl WholeStreamCommand for Clip {
|
|
||||||
fn name(&self) -> &str {
|
|
||||||
"clip"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
|
||||||
Signature::build("clip")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
|
||||||
"Copy the contents of the pipeline to the copy/paste buffer."
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|
||||||
clip(args)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
|
||||||
vec![
|
|
||||||
Example {
|
|
||||||
description: "Save text to the clipboard",
|
|
||||||
example: "echo 'secret value' | clip",
|
|
||||||
result: None,
|
|
||||||
},
|
|
||||||
Example {
|
|
||||||
description: "Save numbers to the clipboard",
|
|
||||||
example: "random integer 10000000..99999999 | clip",
|
|
||||||
result: None,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn clip(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|
||||||
let input = args.input;
|
|
||||||
let name = args.call_info.name_tag;
|
|
||||||
let values: Vec<Value> = input.collect();
|
|
||||||
|
|
||||||
if let Ok(mut clip_context) = Clipboard::new() {
|
|
||||||
let mut new_copy_data = String::new();
|
|
||||||
|
|
||||||
if !values.is_empty() {
|
|
||||||
let mut first = true;
|
|
||||||
for i in &values {
|
|
||||||
if !first {
|
|
||||||
new_copy_data.push('\n');
|
|
||||||
} else {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let string: String = i.convert_to_string();
|
|
||||||
if string.is_empty() {
|
|
||||||
return Err(ShellError::labeled_error(
|
|
||||||
"Unable to convert to string",
|
|
||||||
"Unable to convert to string",
|
|
||||||
name,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
new_copy_data.push_str(&string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match clip_context.set_text(new_copy_data) {
|
|
||||||
Ok(_) => {}
|
|
||||||
Err(_) => {
|
|
||||||
return Err(ShellError::labeled_error(
|
|
||||||
"Could not set contents of clipboard",
|
|
||||||
"could not set contents of clipboard",
|
|
||||||
name,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Err(ShellError::labeled_error(
|
|
||||||
"Could not open clipboard",
|
|
||||||
"could not open clipboard",
|
|
||||||
name,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
Ok(ActionStream::empty())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::Clip;
|
|
||||||
use super::ShellError;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn examples_work_as_expected() -> Result<(), ShellError> {
|
|
||||||
use crate::examples::test as test_examples;
|
|
||||||
|
|
||||||
test_examples(Clip {})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,9 @@
|
|||||||
mod ansi;
|
mod ansi;
|
||||||
mod benchmark;
|
mod benchmark;
|
||||||
mod clear;
|
mod clear;
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
mod clip;
|
|
||||||
mod du;
|
mod du;
|
||||||
mod exec;
|
mod exec;
|
||||||
mod kill;
|
mod kill;
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
mod paste;
|
|
||||||
mod pwd;
|
mod pwd;
|
||||||
mod run_external;
|
mod run_external;
|
||||||
mod sleep;
|
mod sleep;
|
||||||
@ -17,13 +13,9 @@ mod which_;
|
|||||||
pub use ansi::*;
|
pub use ansi::*;
|
||||||
pub use benchmark::Benchmark;
|
pub use benchmark::Benchmark;
|
||||||
pub use clear::Clear;
|
pub use clear::Clear;
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
pub use clip::Clip;
|
|
||||||
pub use du::Du;
|
pub use du::Du;
|
||||||
pub use exec::Exec;
|
pub use exec::Exec;
|
||||||
pub use kill::Kill;
|
pub use kill::Kill;
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
pub use paste::Paste;
|
|
||||||
pub use pwd::Pwd;
|
pub use pwd::Pwd;
|
||||||
pub use run_external::RunExternalCommand;
|
pub use run_external::RunExternalCommand;
|
||||||
pub use sleep::Sleep;
|
pub use sleep::Sleep;
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
use crate::prelude::*;
|
|
||||||
|
|
||||||
use nu_engine::WholeStreamCommand;
|
|
||||||
use nu_errors::ShellError;
|
|
||||||
use nu_protocol::{Primitive, ReturnSuccess, Signature, UntaggedValue};
|
|
||||||
|
|
||||||
use arboard::Clipboard;
|
|
||||||
|
|
||||||
pub struct Paste;
|
|
||||||
|
|
||||||
impl WholeStreamCommand for Paste {
|
|
||||||
fn name(&self) -> &str {
|
|
||||||
"paste"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
|
||||||
Signature::build("paste")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
|
||||||
"Paste contents from the clipboard"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|
||||||
paste(args)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
|
||||||
vec![Example {
|
|
||||||
description: "Paste text from your clipboard",
|
|
||||||
example: "echo 'secret value' | clip | paste",
|
|
||||||
result: Some(vec![UntaggedValue::Primitive(Primitive::String(
|
|
||||||
"secret value".to_owned(),
|
|
||||||
))
|
|
||||||
.into_value(Tag::default())]),
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn paste(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|
||||||
let name = args.call_info.name_tag;
|
|
||||||
|
|
||||||
if let Ok(mut clip_context) = Clipboard::new() {
|
|
||||||
match clip_context.get_text() {
|
|
||||||
Ok(out) => Ok(ActionStream::one(ReturnSuccess::value(
|
|
||||||
UntaggedValue::Primitive(Primitive::String(out)),
|
|
||||||
))),
|
|
||||||
Err(_) => Err(ShellError::labeled_error(
|
|
||||||
"Could not get contents of clipboard",
|
|
||||||
"could not get contents of clipboard",
|
|
||||||
name,
|
|
||||||
)),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Err(ShellError::labeled_error(
|
|
||||||
"Could not open clipboard",
|
|
||||||
"could not open clipboard",
|
|
||||||
name,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,12 +6,6 @@ use nu_protocol::{Dictionary, Signature, UntaggedValue};
|
|||||||
|
|
||||||
pub struct TermSize;
|
pub struct TermSize;
|
||||||
|
|
||||||
#[derive(Deserialize, Clone)]
|
|
||||||
pub struct TermSizeArgs {
|
|
||||||
wide: bool,
|
|
||||||
tall: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WholeStreamCommand for TermSize {
|
impl WholeStreamCommand for TermSize {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"term size"
|
"term size"
|
||||||
|
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 build_string;
|
||||||
mod char_;
|
mod char_;
|
||||||
|
mod detect;
|
||||||
mod format;
|
mod format;
|
||||||
mod lines;
|
mod lines;
|
||||||
mod parse;
|
mod parse;
|
||||||
@ -10,6 +11,7 @@ mod str_;
|
|||||||
|
|
||||||
pub use build_string::BuildString;
|
pub use build_string::BuildString;
|
||||||
pub use char_::Char;
|
pub use char_::Char;
|
||||||
|
pub use detect::DetectColumns;
|
||||||
pub use format::*;
|
pub use format::*;
|
||||||
pub use lines::Lines;
|
pub use lines::Lines;
|
||||||
pub use parse::*;
|
pub use parse::*;
|
||||||
|
@ -144,7 +144,7 @@ fn trim(s: &str, char_: Option<char>, closure_flags: &ClosureFlags) -> String {
|
|||||||
let re_str = format!("{}{{2,}}", reg);
|
let re_str = format!("{}{{2,}}", reg);
|
||||||
// create the regex
|
// create the regex
|
||||||
let re = regex::Regex::new(&re_str).expect("Error creating regular expression");
|
let re = regex::Regex::new(&re_str).expect("Error creating regular expression");
|
||||||
// replace all mutliple occurances with single occurences represented by r
|
// replace all multiple occurrences with single occurrences represented by r
|
||||||
let new_str = re.replace_all(&return_string, r.to_string());
|
let new_str = re.replace_all(&return_string, r.to_string());
|
||||||
// update the return string so the next loop has the latest changes
|
// update the return string so the next loop has the latest changes
|
||||||
return_string = new_str.to_string();
|
return_string = new_str.to_string();
|
||||||
|
@ -76,17 +76,14 @@ impl ConfigExtensions for NuConfig {
|
|||||||
fn header_style(&self) -> TextStyle {
|
fn header_style(&self) -> TextStyle {
|
||||||
// FIXME: I agree, this is the long way around, please suggest and alternative.
|
// 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 = get_color_from_key_and_subkey(self, "color_config", "header_color");
|
||||||
let head_color_style = match head_color {
|
let (head_color_style, head_bold_bool) = match head_color {
|
||||||
Some(s) => {
|
Some(s) => (
|
||||||
lookup_ansi_color_style(s.as_string().unwrap_or_else(|_| "green".to_string()))
|
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(),
|
),
|
||||||
};
|
None => (nu_ansi_term::Color::Green.normal(), true),
|
||||||
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_align = get_color_from_key_and_subkey(self, "color_config", "header_align");
|
let head_align = get_color_from_key_and_subkey(self, "color_config", "header_align");
|
||||||
let head_alignment = match head_align {
|
let head_alignment = match head_align {
|
||||||
Some(a) => header_alignment_from_value(Some(&a)),
|
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(AnsiStrip),
|
||||||
whole_stream_command(AnsiGradient),
|
whole_stream_command(AnsiGradient),
|
||||||
whole_stream_command(Char),
|
whole_stream_command(Char),
|
||||||
|
whole_stream_command(DetectColumns),
|
||||||
// Column manipulation
|
// Column manipulation
|
||||||
whole_stream_command(DropColumn),
|
whole_stream_command(DropColumn),
|
||||||
whole_stream_command(MoveColumn),
|
whole_stream_command(MoveColumn),
|
||||||
@ -365,14 +366,6 @@ pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Bo
|
|||||||
whole_stream_command(DataFrameCumulative),
|
whole_stream_command(DataFrameCumulative),
|
||||||
whole_stream_command(DataFrameRename),
|
whole_stream_command(DataFrameRename),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#[cfg(feature = "clipboard-cli")]
|
|
||||||
{
|
|
||||||
context.add_commands(vec![
|
|
||||||
whole_stream_command(crate::commands::Clip),
|
|
||||||
whole_stream_command(crate::commands::Paste),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(context)
|
Ok(context)
|
||||||
|
@ -306,3 +306,21 @@ fn rm_wildcard_leading_dot_deletes_dotfiles() {
|
|||||||
assert!(!files_exist_at(vec![".bar"], dirs.test()));
|
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());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -47,3 +47,21 @@ fn writes_out_csv() {
|
|||||||
assert!(actual.contains("nu,0.14,A new type of shell,MIT,2018"));
|
assert!(actual.contains("nu,0.14,A new type of shell,MIT,2018"));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn save_append_will_create_file_if_not_exists() {
|
||||||
|
Playground::setup("save_test_3", |dirs, sandbox| {
|
||||||
|
sandbox.with_files(vec![]);
|
||||||
|
|
||||||
|
let expected_file = dirs.test().join("new-file.txt");
|
||||||
|
|
||||||
|
nu!(
|
||||||
|
cwd: dirs.root(),
|
||||||
|
r#"echo hello | save --raw --append save_test_3/new-file.txt"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
let actual = file_contents(expected_file);
|
||||||
|
println!("{}", actual);
|
||||||
|
assert!(actual == "hello");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -4,19 +4,19 @@ description = "Completions for nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-completion"
|
name = "nu-completion"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-engine = { version = "0.38.0", path="../nu-engine" }
|
nu-engine = { version = "0.41.0", path="../nu-engine" }
|
||||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
nu-data = { version = "0.41.0", path="../nu-data" }
|
||||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
nu-parser = { version = "0.41.0", path="../nu-parser" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
@ -4,13 +4,13 @@ description = "CLI for nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-data"
|
name = "nu-data"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
byte-unit = "4.0.9"
|
byte-unit = "4.0.9"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
common-path = "1.0.0"
|
common-path = "1.0.0"
|
||||||
@ -19,7 +19,7 @@ directories-next = "2.0.0"
|
|||||||
getset = "0.1.1"
|
getset = "0.1.1"
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
num-format = "0.4.0"
|
num-format = "0.4.0"
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
serde = { version="1.0.123", features=["derive"] }
|
serde = { version="1.0.123", features=["derive"] }
|
||||||
@ -27,17 +27,14 @@ sha2 = "0.9.3"
|
|||||||
sys-locale = "0.1.0"
|
sys-locale = "0.1.0"
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
|
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-table = { version = "0.38.0", path="../nu-table" }
|
nu-table = { version = "0.41.0", path="../nu-table" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
nu-value-ext = { version = "0.41.0", path="../nu-value-ext" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
|
||||||
users = "0.11.0"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
dataframe = ["nu-protocol/dataframe"]
|
dataframe = ["nu-protocol/dataframe"]
|
||||||
|
@ -102,7 +102,6 @@ pub fn string_to_lookup_value(str_prim: &str) -> String {
|
|||||||
"separator_color" => "separator_color".to_string(),
|
"separator_color" => "separator_color".to_string(),
|
||||||
"header_align" => "header_align".to_string(),
|
"header_align" => "header_align".to_string(),
|
||||||
"header_color" => "header_color".to_string(),
|
"header_color" => "header_color".to_string(),
|
||||||
"header_bold" => "header_bold".to_string(),
|
|
||||||
"header_style" => "header_style".to_string(),
|
"header_style" => "header_style".to_string(),
|
||||||
"index_color" => "index_color".to_string(),
|
"index_color" => "index_color".to_string(),
|
||||||
"leading_trailing_space_bg" => "leading_trailing_space_bg".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("separator_color".to_string(), Color::White.normal());
|
||||||
hm.insert("header_align".to_string(), Color::Green.bold());
|
hm.insert("header_align".to_string(), Color::Green.bold());
|
||||||
hm.insert("header_color".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("header_style".to_string(), Style::default());
|
||||||
hm.insert("index_color".to_string(), Color::Green.bold());
|
hm.insert("index_color".to_string(), Color::Green.bold());
|
||||||
hm.insert(
|
hm.insert(
|
||||||
@ -204,9 +202,6 @@ pub fn get_color_config(config: &NuConfig) -> HashMap<String, Style> {
|
|||||||
"header_color" => {
|
"header_color" => {
|
||||||
update_hashmap(key, value, &mut hm);
|
update_hashmap(key, value, &mut hm);
|
||||||
}
|
}
|
||||||
"header_bold" => {
|
|
||||||
update_hashmap(key, value, &mut hm);
|
|
||||||
}
|
|
||||||
"header_style" => {
|
"header_style" => {
|
||||||
update_hashmap(key, value, &mut hm);
|
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");
|
let style = color_hm.get("header_color");
|
||||||
match style {
|
match style {
|
||||||
Some(s) => TextStyle::with_style(Alignment::Center, *s),
|
Some(s) => TextStyle::with_style(Alignment::Center, *s),
|
||||||
None => TextStyle::default_header(),
|
None => TextStyle::default_header().bold(Some(true)),
|
||||||
}
|
|
||||||
}
|
|
||||||
"header_bold" => {
|
|
||||||
let style = color_hm.get("header_bold");
|
|
||||||
match style {
|
|
||||||
Some(s) => TextStyle::with_style(Alignment::Center, *s),
|
|
||||||
None => TextStyle::default_header(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"header_style" => {
|
"header_style" => {
|
||||||
|
@ -4,27 +4,26 @@ description = "Core commands for nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-engine"
|
name = "nu-engine"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
nu-data = { version = "0.41.0", path="../nu-data" }
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-parser = { version = "0.38.0", path="../nu-parser" }
|
nu-parser = { version = "0.41.0", path="../nu-parser" }
|
||||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
nu-plugin = { version = "0.41.0", path="../nu-plugin" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-stream = { version = "0.38.0", path="../nu-stream" }
|
nu-stream = { version = "0.41.0", path="../nu-stream" }
|
||||||
nu-value-ext = { version = "0.38.0", path="../nu-value-ext" }
|
nu-value-ext = { version = "0.41.0", path="../nu-value-ext" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
|
|
||||||
trash = { version="1.3.0", optional=true }
|
trash = { version = "2.0.2", optional = true }
|
||||||
which = { version="4.0.2", optional=true }
|
which = { version="4.0.2", optional=true }
|
||||||
codespan-reporting = "0.11.0"
|
codespan-reporting = "0.11.0"
|
||||||
ansi_term = "0.12.1"
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bytes = "1.1.0"
|
||||||
bytes = "0.5.6"
|
|
||||||
chrono = { version="0.4.19", features=["serde"] }
|
chrono = { version="0.4.19", features=["serde"] }
|
||||||
derive-new = "0.5.8"
|
derive-new = "0.5.8"
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
@ -37,7 +36,7 @@ indexmap = { version="1.6.1", features=["serde-1"] }
|
|||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
lazy_static = "1.*"
|
lazy_static = "1.*"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
parking_lot = "0.11.1"
|
parking_lot = "0.11.1"
|
||||||
rayon = "1.5.0"
|
rayon = "1.5.0"
|
||||||
serde = { version="1.0.123", features=["derive"] }
|
serde = { version="1.0.123", features=["derive"] }
|
||||||
@ -51,7 +50,7 @@ umask = "1.0.0"
|
|||||||
users = "0.11.0"
|
users = "0.11.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
hamcrest2 = "0.3.0"
|
hamcrest2 = "0.3.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# Nu-Engine
|
# Nu-Engine
|
||||||
|
|
||||||
Nu-engine handles most of the core logic of nushell. For example, engine handles:
|
Nu-engine handles most of the core logic of nushell. For example, engine handles:
|
||||||
- Passing of data between commands
|
|
||||||
- Evaluating a commands return values
|
- Passing of data between commands
|
||||||
- Loading of user configurations
|
- Evaluating a commands return values
|
||||||
|
- Loading of user configurations
|
||||||
|
|
||||||
## Top level introduction
|
## Top level introduction
|
||||||
The following topics shall give the reader a top level understanding how various topics are handled in nushell.
|
The following topics shall give the reader a top level understanding how various topics are handled in nushell.
|
||||||
|
@ -8,22 +8,13 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct DocumentationConfig {
|
pub struct DocumentationConfig {
|
||||||
no_subcommands: bool,
|
no_subcommands: bool,
|
||||||
no_color: bool,
|
no_color: bool,
|
||||||
brief: bool,
|
brief: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DocumentationConfig {
|
|
||||||
fn default() -> Self {
|
|
||||||
DocumentationConfig {
|
|
||||||
no_subcommands: false,
|
|
||||||
no_color: false,
|
|
||||||
brief: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> {
|
fn generate_doc(name: &str, scope: &Scope) -> IndexMap<String, Value> {
|
||||||
let mut row_entries = IndexMap::new();
|
let mut row_entries = IndexMap::new();
|
||||||
let command = scope
|
let command = scope
|
||||||
|
@ -60,7 +60,7 @@ pub fn nu(scope: &Scope, ctx: &EvaluationContext) -> Result<Value, ShellError> {
|
|||||||
// std::env::vars(), rather than the case-sensitive Environment.GetEnvironmentVariables() of .NET that PowerShell
|
// std::env::vars(), rather than the case-sensitive Environment.GetEnvironmentVariables() of .NET that PowerShell
|
||||||
// uses.
|
// uses.
|
||||||
//
|
//
|
||||||
// For now, we work around the discrepency as best we can by merging the two into what is shown to the user as the
|
// For now, we work around the discrepancy as best we can by merging the two into what is shown to the user as the
|
||||||
// 'path' column of `$nu`
|
// 'path' column of `$nu`
|
||||||
let mut table = vec![];
|
let mut table = vec![];
|
||||||
for v in env {
|
for v in env {
|
||||||
|
@ -28,6 +28,12 @@ use nu_errors::ShellError;
|
|||||||
use nu_protocol::{Primitive, ReturnSuccess, UntaggedValue};
|
use nu_protocol::{Primitive, ReturnSuccess, UntaggedValue};
|
||||||
use nu_source::Tagged;
|
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)]
|
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||||
pub enum FilesystemShellMode {
|
pub enum FilesystemShellMode {
|
||||||
Cli,
|
Cli,
|
||||||
@ -159,7 +165,7 @@ impl Shell for FilesystemShell {
|
|||||||
|
|
||||||
let hidden_dir_specified = is_hidden_dir(&path);
|
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))?
|
.map_err(|e| ShellError::labeled_error(e.to_string(), "invalid pattern", &p_tag))?
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
@ -352,7 +358,7 @@ impl Shell for FilesystemShell {
|
|||||||
let source = path.join(&src.item);
|
let source = path.join(&src.item);
|
||||||
let destination = path.join(&dst.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(),
|
Ok(files) => files.collect(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
@ -521,8 +527,8 @@ impl Shell for FilesystemShell {
|
|||||||
let source = path.join(&src.item);
|
let source = path.join(&src.item);
|
||||||
let destination = path.join(&dst.item);
|
let destination = path.join(&dst.item);
|
||||||
|
|
||||||
let mut sources =
|
let mut sources = glob::glob_with(&source.to_string_lossy(), GLOB_PARAMS)
|
||||||
glob::glob(&source.to_string_lossy()).map_or_else(|_| Vec::new(), Iterator::collect);
|
.map_or_else(|_| Vec::new(), Iterator::collect);
|
||||||
|
|
||||||
if sources.is_empty() {
|
if sources.is_empty() {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
@ -650,7 +656,7 @@ impl Shell for FilesystemShell {
|
|||||||
&path.to_string_lossy(),
|
&path.to_string_lossy(),
|
||||||
glob::MatchOptions {
|
glob::MatchOptions {
|
||||||
require_literal_leading_dot: true,
|
require_literal_leading_dot: true,
|
||||||
..Default::default()
|
..GLOB_PARAMS
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Ok(files) => {
|
Ok(files) => {
|
||||||
@ -878,7 +884,7 @@ impl Shell for FilesystemShell {
|
|||||||
) -> Result<OutputStream, ShellError> {
|
) -> Result<OutputStream, ShellError> {
|
||||||
let mut options = OpenOptions::new();
|
let mut options = OpenOptions::new();
|
||||||
if append {
|
if append {
|
||||||
options.append(true)
|
options.append(true).create(true)
|
||||||
} else {
|
} else {
|
||||||
options.write(true).create(true).truncate(true)
|
options.write(true).create(true).truncate(true)
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ impl FileStructure {
|
|||||||
self.resources
|
self.resources
|
||||||
.iter()
|
.iter()
|
||||||
.map(|f| (PathBuf::from(&f.loc), f.at))
|
.map(|f| (PathBuf::from(&f.loc), f.at))
|
||||||
.map(|f| to(f))
|
.map(to)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ impl Default for Theme {
|
|||||||
variable: ThemeColor(Color::Purple),
|
variable: ThemeColor(Color::Purple),
|
||||||
whitespace: ThemeColor(Color::White),
|
whitespace: ThemeColor(Color::White),
|
||||||
word: ThemeColor(Color::Green),
|
word: ThemeColor(Color::Green),
|
||||||
// These should really be Syles and not colors
|
// These should really be Styles and not colors
|
||||||
// leave this here for the next change to make
|
// leave this here for the next change to make
|
||||||
// ThemeColor, ThemeStyle.
|
// ThemeColor, ThemeStyle.
|
||||||
// open_delimiter: ThemeColor(Color::White.normal()),
|
// open_delimiter: ThemeColor(Color::White.normal()),
|
||||||
|
@ -597,7 +597,7 @@ impl VarSyntaxShapeDeductor {
|
|||||||
}
|
}
|
||||||
Expression::Table(header, _rows) => {
|
Expression::Table(header, _rows) => {
|
||||||
self.infer_shapes_in_table_header(header)?;
|
self.infer_shapes_in_table_header(header)?;
|
||||||
// Shapes within columns can be heterogenous as long as
|
// Shapes within columns can be heterogeneous as long as
|
||||||
// https://github.com/nushell/rfcs/pull/3
|
// https://github.com/nushell/rfcs/pull/3
|
||||||
// didn't land
|
// didn't land
|
||||||
// self.infer_shapes_in_rows(_rows)?;
|
// self.infer_shapes_in_rows(_rows)?;
|
||||||
|
@ -4,20 +4,20 @@ description = "Core error subsystem for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-errors"
|
name = "nu-errors"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
|
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
codespan-reporting = { version="0.11.0", features=["serialization"] }
|
codespan-reporting = { version="0.11.0", features=["serialization"] }
|
||||||
derive-new = "0.5.8"
|
derive-new = "0.5.8"
|
||||||
getset = "0.1.1"
|
getset = "0.1.1"
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
serde = { version="1.0.123", features=["derive"] }
|
serde = { version="1.0.123", features=["derive"] }
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ description = "Fork of serde-hjson"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-json"
|
name = "nu-json"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -20,6 +20,6 @@ lazy_static = "1"
|
|||||||
linked-hash-map = { version="0.5", optional=true }
|
linked-hash-map = { version="0.5", optional=true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
serde_json = "1.0.39"
|
serde_json = "1.0.39"
|
||||||
|
@ -925,11 +925,8 @@ fn escape_char<W>(wr: &mut W, value: char) -> Result<()>
|
|||||||
where
|
where
|
||||||
W: io::Write,
|
W: io::Write,
|
||||||
{
|
{
|
||||||
// FIXME: this allocation is required in order to be compatible with stable
|
let mut scratch = [0_u8; 4];
|
||||||
// rust, which doesn't support encoding a `char` into a stack buffer.
|
escape_bytes(wr, value.encode_utf8(&mut scratch).as_bytes())
|
||||||
let mut s = String::new();
|
|
||||||
s.push(value);
|
|
||||||
escape_bytes(wr, s.as_bytes())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> Result<()>
|
fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> Result<()>
|
||||||
|
@ -4,23 +4,23 @@ description = "Nushell parser"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-parser"
|
name = "nu-parser"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
derive-new = "0.5.8"
|
derive-new = "0.5.8"
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
smart-default = "0.6.0"
|
smart-default = "0.6.0"
|
||||||
|
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-data = { version = "0.38.0", path="../nu-data" }
|
nu-data = { version = "0.41.0", path="../nu-data" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
nu-test-support = { version = "0.38.0", path="../nu-test-support" }
|
nu-test-support = { version = "0.41.0", path="../nu-test-support" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
stable = []
|
stable = []
|
||||||
|
@ -132,7 +132,7 @@ mod tests {
|
|||||||
|
|
||||||
match spec {
|
match spec {
|
||||||
NamedType::Optional(_, _) => {}
|
NamedType::Optional(_, _) => {}
|
||||||
_ => panic!("optional flag didn't parse succesfully"),
|
_ => panic!("optional flag didn't parse successfully"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,7 +901,7 @@ fn parse_arg(
|
|||||||
return parse_dollar_expr(lite_arg, scope);
|
return parse_dollar_expr(lite_arg, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
// before anything else, try to see if this is a number in paranthesis
|
// before anything else, try to see if this is a number in parenthesis
|
||||||
if lite_arg.item.starts_with('(') {
|
if lite_arg.item.starts_with('(') {
|
||||||
return parse_full_column_path(lite_arg, scope);
|
return parse_full_column_path(lite_arg, scope);
|
||||||
}
|
}
|
||||||
@ -1559,11 +1559,16 @@ fn parse_internal_command(
|
|||||||
if error.is_none() {
|
if error.is_none() {
|
||||||
error = err;
|
error = err;
|
||||||
}
|
}
|
||||||
} else if error.is_none() {
|
} else {
|
||||||
error = Some(ParseError::argument_error(
|
if error.is_none() {
|
||||||
lite_cmd.parts[0].clone(),
|
error = Some(ParseError::argument_error(
|
||||||
ArgumentError::MissingValueForName(full_name.to_owned()),
|
lite_cmd.parts[0].clone(),
|
||||||
));
|
ArgumentError::MissingValueForName(
|
||||||
|
full_name.to_owned(),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ description = "Path handling library for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-path"
|
name = "nu-path"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
|
@ -19,7 +19,7 @@ fn handle_dots_push(string: &mut String, count: u8) {
|
|||||||
string.pop(); // remove last '/'
|
string.pop(); // remove last '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Expands any occurence of more than two dots into a sequence of ../ (or ..\ on windows), e.g.,
|
/// Expands any occurrence of more than two dots into a sequence of ../ (or ..\ on windows), e.g.,
|
||||||
/// "..." into "../..", "...." into "../../../", etc.
|
/// "..." into "../..", "...." into "../../../", etc.
|
||||||
pub fn expand_ndots(path: impl AsRef<Path>) -> PathBuf {
|
pub fn expand_ndots(path: impl AsRef<Path>) -> PathBuf {
|
||||||
// Check if path is valid UTF-8 and if not, return it as it is to avoid breaking it via string
|
// Check if path is valid UTF-8 and if not, return it as it is to avoid breaking it via string
|
||||||
|
@ -4,17 +4,17 @@ description = "Nushell Plugin"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-plugin"
|
name = "nu-plugin"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
nu-test-support = { path="../nu-test-support", version = "0.38.0" }
|
nu-test-support = { path="../nu-test-support", version = "0.41.0" }
|
||||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
nu-value-ext = { path="../nu-value-ext", version = "0.41.0" }
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
serde = { version="1.0", features=["derive"] }
|
serde = { version="1.0", features=["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -55,7 +55,6 @@ pub fn serve_plugin(plugin: &mut dyn Plugin) {
|
|||||||
match command {
|
match command {
|
||||||
Ok(NuCommand::config) => {
|
Ok(NuCommand::config) => {
|
||||||
send_response(plugin.config());
|
send_response(plugin.config());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
Ok(NuCommand::begin_filter { params }) => {
|
Ok(NuCommand::begin_filter { params }) => {
|
||||||
send_response(plugin.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) => {
|
Ok(NuCommand::end_filter) => {
|
||||||
send_response(plugin.end_filter());
|
send_response(plugin.end_filter());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(NuCommand::sink { params }) => {
|
Ok(NuCommand::sink { params }) => {
|
||||||
plugin.sink(params.0, params.1);
|
plugin.sink(params.0, params.1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
Ok(NuCommand::quit) => {
|
Ok(NuCommand::quit) => {
|
||||||
plugin.quit();
|
plugin.quit();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
e => {
|
e => {
|
||||||
send_response(ShellError::untagged_runtime_error(format!(
|
send_response(ShellError::untagged_runtime_error(format!(
|
||||||
"Could not handle plugin message: {} {:?}",
|
"Could not handle plugin message: {} {:?}",
|
||||||
input, e
|
input, e
|
||||||
)));
|
)));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ description = "Pretty hex dump of bytes slice in the common style."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-pretty-hex"
|
name = "nu-pretty-hex"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
@ -16,11 +16,11 @@ name = "nu_pretty_hex"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-ansi-term = { path="../nu-ansi-term", version = "0.38.0" }
|
nu-ansi-term = { path="../nu-ansi-term", version = "0.41.0" }
|
||||||
rand = "0.8.3"
|
rand = "0.8.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
heapless = "0.6.1"
|
heapless = { version = "0.7.8", default-features = false }
|
||||||
|
|
||||||
# [features]
|
# [features]
|
||||||
# default = ["alloc"]
|
# 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();
|
core::str::from_utf8(b"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f").unwrap();
|
||||||
// let expected =
|
// 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;";
|
// "\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();
|
hex_write(&mut buffer, &bytes, config, None).unwrap();
|
||||||
|
|
||||||
|
@ -4,13 +4,13 @@ description = "Core values and protocols for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-protocol"
|
name = "nu-protocol"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
byte-unit = "4.0.9"
|
byte-unit = "4.0.9"
|
||||||
chrono = { version="0.4.19", features=["serde"] }
|
chrono = { version="0.4.19", features=["serde"] }
|
||||||
chrono-humanize = "0.2.1"
|
chrono-humanize = "0.2.1"
|
||||||
@ -18,18 +18,19 @@ derive-new = "0.5.8"
|
|||||||
getset = "0.1.1"
|
getset = "0.1.1"
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version = "0.4.3", features = ["serde"] }
|
||||||
num-integer = "0.1.44"
|
num-integer = "0.1.44"
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
serde = { version="1.0", features=["derive"] }
|
serde = { version="1.0", features=["derive"] }
|
||||||
serde_bytes = "0.11.5"
|
serde_bytes = "0.11.5"
|
||||||
|
|
||||||
[dependencies.polars]
|
[dependencies.polars]
|
||||||
version = "0.16.0"
|
version = "0.17.0"
|
||||||
optional = true
|
optional = true
|
||||||
features = ["default", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-duration-ns"]
|
default-features = false
|
||||||
|
features = ["docs", "zip_with", "csv-file", "temporal", "performant", "pretty_fmt", "dtype-slim", "serde", "rows", "strings", "checked_arithmetic", "object", "dtype-date", "dtype-datetime", "dtype-time"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
dataframe = ["polars"]
|
dataframe = ["polars"]
|
||||||
|
@ -603,7 +603,7 @@ where
|
|||||||
{
|
{
|
||||||
match series.dtype() {
|
match series.dtype() {
|
||||||
DataType::UInt32 | DataType::Int32 | DataType::UInt64 => {
|
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 {
|
match to_i64 {
|
||||||
Ok(series) => {
|
Ok(series) => {
|
||||||
@ -661,7 +661,7 @@ where
|
|||||||
{
|
{
|
||||||
match series.dtype() {
|
match series.dtype() {
|
||||||
DataType::Float32 => {
|
DataType::Float32 => {
|
||||||
let to_f64 = series.cast_with_dtype(&DataType::Float64);
|
let to_f64 = series.cast(&DataType::Float64);
|
||||||
|
|
||||||
match to_f64 {
|
match to_f64 {
|
||||||
Ok(series) => {
|
Ok(series) => {
|
||||||
@ -731,7 +731,7 @@ where
|
|||||||
{
|
{
|
||||||
match series.dtype() {
|
match series.dtype() {
|
||||||
DataType::UInt32 | DataType::Int32 | DataType::UInt64 => {
|
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 {
|
match to_i64 {
|
||||||
Ok(series) => {
|
Ok(series) => {
|
||||||
@ -789,7 +789,7 @@ where
|
|||||||
{
|
{
|
||||||
match series.dtype() {
|
match series.dtype() {
|
||||||
DataType::Float32 => {
|
DataType::Float32 => {
|
||||||
let to_f64 = series.cast_with_dtype(&DataType::Float64);
|
let to_f64 = series.cast(&DataType::Float64);
|
||||||
|
|
||||||
match to_f64 {
|
match to_f64 {
|
||||||
Ok(series) => {
|
Ok(series) => {
|
||||||
|
@ -8,8 +8,8 @@ use nu_errors::ShellError;
|
|||||||
use nu_source::{Span, Tag};
|
use nu_source::{Span, Tag};
|
||||||
use num_bigint::BigInt;
|
use num_bigint::BigInt;
|
||||||
use polars::prelude::{
|
use polars::prelude::{
|
||||||
DataFrame, DataType, Date64Type, Int64Type, IntoSeries, NamedFrom, NewChunkedArray, ObjectType,
|
DataFrame, DataType, DatetimeChunked, Int64Type, IntoSeries, NamedFrom, NewChunkedArray,
|
||||||
PolarsNumericType, Series, TimeUnit,
|
ObjectType, PolarsNumericType, Series,
|
||||||
};
|
};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ pub fn create_column(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataType::Date32 => {
|
DataType::Date => {
|
||||||
let casted = series.date32().map_err(|e| {
|
let casted = series.date().map_err(|e| {
|
||||||
ShellError::labeled_error(
|
ShellError::labeled_error(
|
||||||
"Casting error",
|
"Casting error",
|
||||||
format!("casting error: {}", e),
|
format!("casting error: {}", e),
|
||||||
@ -347,8 +347,8 @@ pub fn create_column(
|
|||||||
|
|
||||||
Ok(Column::new(casted.name().into(), values))
|
Ok(Column::new(casted.name().into(), values))
|
||||||
}
|
}
|
||||||
DataType::Date64 => {
|
DataType::Datetime => {
|
||||||
let casted = series.date64().map_err(|e| {
|
let casted = series.datetime().map_err(|e| {
|
||||||
ShellError::labeled_error(
|
ShellError::labeled_error(
|
||||||
"Casting error",
|
"Casting error",
|
||||||
format!("casting error: {}", e),
|
format!("casting error: {}", e),
|
||||||
@ -384,8 +384,8 @@ pub fn create_column(
|
|||||||
|
|
||||||
Ok(Column::new(casted.name().into(), values))
|
Ok(Column::new(casted.name().into(), values))
|
||||||
}
|
}
|
||||||
DataType::Time64(timeunit) | DataType::Duration(timeunit) => {
|
DataType::Time => {
|
||||||
let casted = series.time64_nanosecond().map_err(|e| {
|
let casted = series.time().map_err(|e| {
|
||||||
ShellError::labeled_error(
|
ShellError::labeled_error(
|
||||||
"Casting error",
|
"Casting error",
|
||||||
format!("casting error: {}", e),
|
format!("casting error: {}", e),
|
||||||
@ -398,14 +398,7 @@ pub fn create_column(
|
|||||||
.skip(from_row)
|
.skip(from_row)
|
||||||
.take(size)
|
.take(size)
|
||||||
.map(|v| match v {
|
.map(|v| match v {
|
||||||
Some(a) => {
|
Some(nanoseconds) => {
|
||||||
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,
|
|
||||||
};
|
|
||||||
|
|
||||||
let untagged = if let Some(bigint) = BigInt::from_i64(nanoseconds) {
|
let untagged = if let Some(bigint) = BigInt::from_i64(nanoseconds) {
|
||||||
UntaggedValue::Primitive(Primitive::Duration(bigint))
|
UntaggedValue::Primitive(Primitive::Duration(bigint))
|
||||||
} else {
|
} 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())
|
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.
|
// Casting needed to compare other numeric types with nushell numeric type.
|
||||||
// In nushell we only have i64 integer numeric types and any array created
|
// In nushell we only have i64 integer numeric types and any array created
|
||||||
// with nushell untagged primitives will be of type i64
|
// 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,
|
Ok(series) => series,
|
||||||
Err(_) => return false,
|
Err(_) => return false,
|
||||||
},
|
},
|
||||||
|
@ -290,7 +290,7 @@ impl Primitive {
|
|||||||
.expect("Internal error: conversion from u32 failed"),
|
.expect("Internal error: conversion from u32 failed"),
|
||||||
);
|
);
|
||||||
let secs = match secs.to_i64() {
|
let secs = match secs.to_i64() {
|
||||||
//The duration crate doesnt accept seconds bigger than i64::MAX / 1000
|
//The duration crate doesn't accept seconds bigger than i64::MAX / 1000
|
||||||
Some(secs) => match secs.checked_mul(1000) {
|
Some(secs) => match secs.checked_mul(1000) {
|
||||||
Some(_) => secs,
|
Some(_) => secs,
|
||||||
None => {
|
None => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nu-serde"
|
name = "nu-serde"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = ["The Nu Project Contributors"]
|
authors = ["The Nu Project Contributors"]
|
||||||
description = "Turn any value into a nu-protocol::Value with serde"
|
description = "Turn any value into a nu-protocol::Value with serde"
|
||||||
@ -9,9 +9,9 @@ repository = "https://github.com/nushell/nushell"
|
|||||||
documentation = "https://docs.rs/nu-serde"
|
documentation = "https://docs.rs/nu-serde"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
nu-protocol = { version = "0.38.0", path = "../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path = "../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path = "../nu-source" }
|
nu-source = { version = "0.41.0", path = "../nu-source" }
|
||||||
serde = "1"
|
serde = "1"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ description = "A source string characterizer for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-source"
|
name = "nu-source"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
@ -4,12 +4,12 @@ description = "Nushell stream"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-stream"
|
name = "nu-stream"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
stable = []
|
stable = []
|
||||||
|
@ -4,7 +4,7 @@ description = "Nushell table printing"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-table"
|
name = "nu-table"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[[bin]]
|
[[bin]]
|
||||||
@ -13,7 +13,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atty = "0.2.14"
|
atty = "0.2.14"
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
|
|
||||||
regex = "1.4"
|
regex = "1.4"
|
||||||
strip-ansi-escapes = "0.1.1"
|
strip-ansi-escapes = "0.1.1"
|
||||||
|
@ -4,22 +4,22 @@ description = "Support for writing Nushell tests"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-test-support"
|
name = "nu-test-support"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-path = { version = "0.38.0", path="../nu-path" }
|
nu-path = { version = "0.41.0", path="../nu-path" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
|
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
getset = "0.1.1"
|
getset = "0.1.1"
|
||||||
glob = "0.3.0"
|
glob = "0.3.0"
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
num-bigint = { version="0.3.1", features=["serde"] }
|
num-bigint = { version="0.4.3", features=["serde"] }
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
hamcrest2 = "0.3.0"
|
hamcrest2 = "0.3.0"
|
||||||
|
@ -33,7 +33,7 @@ pub struct NuError {
|
|||||||
pub output: Option<Outcome>,
|
pub output: Option<Outcome>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct NuProcess {
|
pub struct NuProcess {
|
||||||
pub arguments: Vec<OsString>,
|
pub arguments: Vec<OsString>,
|
||||||
pub environment_vars: Vec<EnvironmentVariable>,
|
pub environment_vars: Vec<EnvironmentVariable>,
|
||||||
@ -52,16 +52,6 @@ impl fmt::Display for NuProcess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NuProcess {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
arguments: vec![],
|
|
||||||
environment_vars: Vec::default(),
|
|
||||||
cwd: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NuProcess {
|
impl NuProcess {
|
||||||
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut Self {
|
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut Self {
|
||||||
self.arguments.push(arg.as_ref().to_os_string());
|
self.arguments.push(arg.as_ref().to_os_string());
|
||||||
|
@ -4,15 +4,15 @@ description = "Extension traits for values in Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-value-ext"
|
name = "nu-value-ext"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
|
|
||||||
indexmap = { version="1.6.1", features=["serde-1"] }
|
indexmap = { version="1.6.1", features=["serde-1"] }
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
|
@ -4,21 +4,21 @@ description = "A binary viewer plugin for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_binaryview"
|
name = "nu_plugin_binaryview"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossterm = "0.19"
|
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"
|
neso = "0.5.0"
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
nu-ansi-term = { version = "0.38.0", path="../nu-ansi-term" }
|
nu-ansi-term = { version = "0.41.0", path="../nu-ansi-term" }
|
||||||
nu-pretty-hex = { version = "0.38.0", path="../nu-pretty-hex" }
|
nu-pretty-hex = { version = "0.41.0", path="../nu-pretty-hex" }
|
||||||
rawkey = "0.1.3"
|
rawkey = "0.1.3"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -167,7 +167,7 @@ impl RenderContext {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct RawImageBuffer {
|
struct RawImageBuffer {
|
||||||
dimensions: (u64, u64),
|
dimensions: (u32, u32),
|
||||||
colortype: image::ColorType,
|
colortype: image::ColorType,
|
||||||
buffer: Vec<u8>,
|
buffer: Vec<u8>,
|
||||||
}
|
}
|
||||||
@ -175,11 +175,12 @@ struct RawImageBuffer {
|
|||||||
fn load_from_png_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::error::Error>> {
|
fn load_from_png_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::error::Error>> {
|
||||||
use image::ImageDecoder;
|
use image::ImageDecoder;
|
||||||
|
|
||||||
let decoder = image::png::PNGDecoder::new(buffer)?;
|
let decoder = image::codecs::png::PngDecoder::new(buffer)?;
|
||||||
|
|
||||||
let dimensions = decoder.dimensions();
|
let dimensions = decoder.dimensions();
|
||||||
let colortype = decoder.colortype();
|
let colortype = decoder.color_type();
|
||||||
let buffer = decoder.read_image()?;
|
let mut buffer: Vec<u8> = vec![0; decoder.total_bytes() as usize];
|
||||||
|
decoder.read_image(&mut buffer)?;
|
||||||
|
|
||||||
Ok(RawImageBuffer {
|
Ok(RawImageBuffer {
|
||||||
dimensions,
|
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>> {
|
fn load_from_jpg_buffer(buffer: &[u8]) -> Result<RawImageBuffer, Box<dyn std::error::Error>> {
|
||||||
use image::ImageDecoder;
|
use image::ImageDecoder;
|
||||||
|
|
||||||
let decoder = image::jpeg::JPEGDecoder::new(buffer)?;
|
let decoder = image::codecs::jpeg::JpegDecoder::new(buffer)?;
|
||||||
|
|
||||||
let dimensions = decoder.dimensions();
|
let dimensions = decoder.dimensions();
|
||||||
let colortype = decoder.colortype();
|
let colortype = decoder.color_type();
|
||||||
let buffer = decoder.read_image()?;
|
let mut buffer: Vec<u8> = vec![0; decoder.total_bytes() as usize];
|
||||||
|
decoder.read_image(&mut buffer)?;
|
||||||
|
|
||||||
Ok(RawImageBuffer {
|
Ok(RawImageBuffer {
|
||||||
dimensions,
|
dimensions,
|
||||||
@ -245,7 +247,7 @@ pub fn view_contents(
|
|||||||
render_context.clear();
|
render_context.clear();
|
||||||
|
|
||||||
match raw_image_buffer.colortype {
|
match raw_image_buffer.colortype {
|
||||||
image::ColorType::RGBA(8) => {
|
image::ColorType::Rgba8 => {
|
||||||
let img = image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::from_vec(
|
let img = image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::from_vec(
|
||||||
raw_image_buffer.dimensions.0 as u32,
|
raw_image_buffer.dimensions.0 as u32,
|
||||||
raw_image_buffer.dimensions.1 as u32,
|
raw_image_buffer.dimensions.1 as u32,
|
||||||
@ -257,7 +259,7 @@ pub fn view_contents(
|
|||||||
&img,
|
&img,
|
||||||
render_context.width as u32,
|
render_context.width as u32,
|
||||||
render_context.height as u32,
|
render_context.height as u32,
|
||||||
image::FilterType::Lanczos3,
|
image::imageops::FilterType::Lanczos3,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (count, pixel) in resized_img.pixels().enumerate() {
|
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]);
|
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(
|
let img = image::ImageBuffer::<image::Rgb<u8>, Vec<u8>>::from_vec(
|
||||||
raw_image_buffer.dimensions.0 as u32,
|
raw_image_buffer.dimensions.0 as u32,
|
||||||
raw_image_buffer.dimensions.1 as u32,
|
raw_image_buffer.dimensions.1 as u32,
|
||||||
@ -278,7 +280,7 @@ pub fn view_contents(
|
|||||||
&img,
|
&img,
|
||||||
render_context.width as u32,
|
render_context.width as u32,
|
||||||
render_context.height as u32,
|
render_context.height as u32,
|
||||||
image::FilterType::Lanczos3,
|
image::imageops::FilterType::Lanczos3,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (count, pixel) in resized_img.pixels().enumerate() {
|
for (count, pixel) in resized_img.pixels().enumerate() {
|
||||||
@ -359,7 +361,7 @@ pub fn view_contents_interactive(
|
|||||||
&img,
|
&img,
|
||||||
render_context.width as u32,
|
render_context.width as u32,
|
||||||
render_context.height as u32,
|
render_context.height as u32,
|
||||||
image::FilterType::Lanczos3,
|
image::imageops::FilterType::Lanczos3,
|
||||||
);
|
);
|
||||||
|
|
||||||
render_context.clear();
|
render_context.clear();
|
||||||
|
@ -4,18 +4,18 @@ description = "A plugin to display charts"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_chart"
|
name = "nu_plugin_chart"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-data = { path="../nu-data", version = "0.38.0" }
|
nu-data = { path="../nu-data", version = "0.41.0" }
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
nu-value-ext = { path="../nu-value-ext", version = "0.41.0" }
|
||||||
|
|
||||||
crossterm = "0.19.0"
|
crossterm = "0.19.0"
|
||||||
tui = { version="0.15.0", default-features=false, features=["crossterm"] }
|
tui = { version="0.15.0", default-features=false, features=["crossterm"] }
|
||||||
|
@ -20,8 +20,7 @@ const DEFAULT_LINE_COLORS: [Color; 5] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Line<'a> {
|
pub struct Line {
|
||||||
title: &'a str,
|
|
||||||
x_labels: Vec<String>,
|
x_labels: Vec<String>,
|
||||||
x_range: [f64; 2],
|
x_range: [f64; 2],
|
||||||
y_range: [f64; 2],
|
y_range: [f64; 2],
|
||||||
@ -29,10 +28,9 @@ pub struct Line<'a> {
|
|||||||
data: Vec<Vec<(f64, f64)>>,
|
data: Vec<Vec<(f64, f64)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Line<'a> {
|
impl<'a> Line {
|
||||||
pub fn from_model(model: &'a Model) -> Result<Line<'a>, ShellError> {
|
pub fn from_model(model: &'a Model) -> Result<Line, ShellError> {
|
||||||
Ok(Line {
|
Ok(Line {
|
||||||
title: "Line Chart",
|
|
||||||
x_labels: model.labels.x.to_vec(),
|
x_labels: model.labels.x.to_vec(),
|
||||||
x_range: [
|
x_range: [
|
||||||
model.ranges.0.start.as_u64()? as f64,
|
model.ranges.0.start.as_u64()? as f64,
|
||||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the bson format for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_from_bson"
|
name = "nu_plugin_from_bson"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
bson = { version="0.14.1", features=["decimal128"] }
|
bson = { version = "2.0.1", features = [ "chrono-0_4" ] }
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use bigdecimal::BigDecimal;
|
use bigdecimal::BigDecimal;
|
||||||
use bson::{decode_document, spec::BinarySubtype, Bson};
|
use bson::{spec::BinarySubtype, Bson};
|
||||||
use nu_errors::{ExpectedRange, ShellError};
|
use nu_errors::{ExpectedRange, ShellError};
|
||||||
use nu_protocol::{Primitive, ReturnSuccess, ReturnValue, TaggedDictBuilder, UntaggedValue, Value};
|
use nu_protocol::{Primitive, ReturnSuccess, ReturnValue, TaggedDictBuilder, UntaggedValue, Value};
|
||||||
use nu_source::{SpannedItem, Tag};
|
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;
|
let span = tag.span;
|
||||||
|
|
||||||
Ok(match v {
|
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) => {
|
Bson::String(s) => {
|
||||||
UntaggedValue::Primitive(Primitive::String(String::from(s))).into_value(&tag)
|
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::Boolean(b) => UntaggedValue::Primitive(Primitive::Boolean(*b)).into_value(&tag),
|
||||||
Bson::Null => UntaggedValue::Primitive(Primitive::Nothing).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());
|
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
"$regex".to_string(),
|
"$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(
|
collected.insert_value(
|
||||||
"$options".to_string(),
|
"$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()
|
collected.into_value()
|
||||||
}
|
}
|
||||||
Bson::I32(n) => UntaggedValue::int(*n).into_value(&tag),
|
Bson::Int32(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||||
Bson::I64(n) => UntaggedValue::int(*n).into_value(&tag),
|
Bson::Int64(n) => UntaggedValue::int(*n).into_value(&tag),
|
||||||
Bson::Decimal128(n) => {
|
Bson::Decimal128(n) => {
|
||||||
// TODO: this really isn't great, and we should update this to do a higher
|
// TODO: this really isn't great, and we should update this to do a higher
|
||||||
// fidelity translation
|
// fidelity translation
|
||||||
@ -84,41 +86,43 @@ fn convert_bson_value_to_nu_value(v: &Bson, tag: impl Into<Tag>) -> Result<Value
|
|||||||
);
|
);
|
||||||
collected.into_value()
|
collected.into_value()
|
||||||
}
|
}
|
||||||
Bson::JavaScriptCodeWithScope(js, doc) => {
|
Bson::JavaScriptCodeWithScope(js) => {
|
||||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
"$javascript".to_string(),
|
"$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(
|
collected.insert_value(
|
||||||
"$scope".to_string(),
|
"$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()
|
collected.into_value()
|
||||||
}
|
}
|
||||||
Bson::TimeStamp(ts) => {
|
Bson::Timestamp(ts) => {
|
||||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
"$timestamp".to_string(),
|
"$timestamp".to_string(),
|
||||||
UntaggedValue::int(*ts).into_value(&tag),
|
UntaggedValue::int(ts.time).into_value(&tag),
|
||||||
);
|
);
|
||||||
collected.into_value()
|
collected.into_value()
|
||||||
}
|
}
|
||||||
Bson::Binary(bst, bytes) => {
|
Bson::Binary(binary) => {
|
||||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
"$binary_subtype".to_string(),
|
"$binary_subtype".to_string(),
|
||||||
match bst {
|
match binary.subtype {
|
||||||
BinarySubtype::UserDefined(u) => UntaggedValue::int(*u),
|
BinarySubtype::UserDefined(u) => UntaggedValue::int(u),
|
||||||
_ => {
|
_ => UntaggedValue::Primitive(Primitive::String(binary_subtype_to_string(
|
||||||
UntaggedValue::Primitive(Primitive::String(binary_subtype_to_string(*bst)))
|
binary.subtype,
|
||||||
}
|
))),
|
||||||
}
|
}
|
||||||
.into_value(&tag),
|
.into_value(&tag),
|
||||||
);
|
);
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
"$binary".to_string(),
|
"$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()
|
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()
|
collected.into_value()
|
||||||
}
|
}
|
||||||
Bson::UtcDatetime(dt) => {
|
Bson::DateTime(dt) => {
|
||||||
UntaggedValue::Primitive(Primitive::Date((*dt).into())).into_value(&tag)
|
UntaggedValue::Primitive(Primitive::Date(dt.to_chrono().into())).into_value(&tag)
|
||||||
}
|
}
|
||||||
Bson::Symbol(s) => {
|
Bson::Symbol(s) => {
|
||||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
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()
|
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> {
|
pub fn from_bson_bytes_to_value(bytes: Vec<u8>, tag: impl Into<Tag>) -> Result<Value, ShellError> {
|
||||||
let mut docs = Vec::new();
|
let mut docs = Vec::new();
|
||||||
let mut b_reader = BytesReader::new(bytes);
|
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));
|
docs.push(Bson::Document(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,17 @@ description = "A converter plugin to the mp4 format for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_from_mp4"
|
name = "nu_plugin_from_mp4"
|
||||||
version = "0.1.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
mp4 = "0.8.2"
|
mp4 = "0.9.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -27,7 +27,7 @@ pub fn convert_mp4_file_to_nu_value(path: &Path, tag: Tag) -> Result<Value, mp4:
|
|||||||
|
|
||||||
// Build tracks table
|
// Build tracks table
|
||||||
let mut tracks = Vec::new();
|
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());
|
let mut curr_track_dict = TaggedDictBuilder::new(tag.clone());
|
||||||
|
|
||||||
curr_track_dict.insert_untagged("track id", UntaggedValue::int(track.track_id()));
|
curr_track_dict.insert_untagged("track id", UntaggedValue::int(track.track_id()));
|
||||||
|
@ -4,21 +4,21 @@ description = "A converter plugin to the bson format for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_from_sqlite"
|
name = "nu_plugin_from_sqlite"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bigdecimal = { package = "bigdecimal-rs", version = "0.2.1", features = ["serde"] }
|
bigdecimal = { package = "bigdecimal", version = "0.3.0", features = ["serde"] }
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
|
|
||||||
[dependencies.rusqlite]
|
[dependencies.rusqlite]
|
||||||
features = ["bundled", "blob"]
|
features = ["bundled", "blob"]
|
||||||
version = "0.25.3"
|
version = "0.26.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -61,7 +61,7 @@ pub fn convert_sqlite_file_to_nu_value(
|
|||||||
|
|
||||||
fn convert_sqlite_row_to_nu_value(row: &Row, tag: impl Into<Tag> + Clone) -> Value {
|
fn convert_sqlite_row_to_nu_value(row: &Row, tag: impl Into<Tag> + Clone) -> Value {
|
||||||
let mut collected = TaggedDictBuilder::new(tag.clone());
|
let mut collected = TaggedDictBuilder::new(tag.clone());
|
||||||
for (i, c) in row.column_names().iter().enumerate() {
|
for (i, c) in row.as_ref().column_names().iter().enumerate() {
|
||||||
collected.insert_value(
|
collected.insert_value(
|
||||||
c.to_string(),
|
c.to_string(),
|
||||||
convert_sqlite_value_to_nu_value(row.get_ref_unwrap(i), tag.clone()),
|
convert_sqlite_value_to_nu_value(row.get_ref_unwrap(i), tag.clone()),
|
||||||
|
@ -4,18 +4,18 @@ description = "A version incrementer plugin for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_inc"
|
name = "nu_plugin_inc"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
nu-source = { path="../nu-source", version = "0.38.0" }
|
nu-source = { path="../nu-source", version = "0.41.0" }
|
||||||
nu-test-support = { path="../nu-test-support", version = "0.38.0" }
|
nu-test-support = { path="../nu-test-support", version = "0.41.0" }
|
||||||
nu-value-ext = { path="../nu-value-ext", version = "0.38.0" }
|
nu-value-ext = { path="../nu-value-ext", version = "0.41.0" }
|
||||||
|
|
||||||
semver = "0.11.0"
|
semver = "0.11.0"
|
||||||
|
|
||||||
|
@ -4,15 +4,15 @@ description = "A regex match plugin for Nushell"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_match"
|
name = "nu_plugin_match"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-errors = { path="../nu-errors", version = "0.38.0" }
|
nu-errors = { path="../nu-errors", version = "0.41.0" }
|
||||||
nu-plugin = { path="../nu-plugin", version = "0.38.0" }
|
nu-plugin = { path="../nu-plugin", version = "0.41.0" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.38.0" }
|
nu-protocol = { path="../nu-protocol", version = "0.41.0" }
|
||||||
regex = "1.4.3"
|
regex = "1.4.3"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -4,14 +4,14 @@ description = "query json files with gjson"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu_plugin_query_json"
|
name = "nu_plugin_query_json"
|
||||||
version = "0.38.0"
|
version = "0.41.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gjson = "0.7.1"
|
gjson = "0.8.0"
|
||||||
nu-errors = { version = "0.38.0", path="../nu-errors" }
|
nu-errors = { version = "0.41.0", path="../nu-errors" }
|
||||||
nu-plugin = { version = "0.38.0", path="../nu-plugin" }
|
nu-plugin = { version = "0.41.0", path="../nu-plugin" }
|
||||||
nu-protocol = { version = "0.38.0", path="../nu-protocol" }
|
nu-protocol = { version = "0.41.0", path="../nu-protocol" }
|
||||||
nu-source = { version = "0.38.0", path="../nu-source" }
|
nu-source = { version = "0.41.0", path="../nu-source" }
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user