1
0
mirror of https://github.com/nushell/nushell.git synced 2025-04-26 22:28:19 +02:00
Commit Graph

7 Commits

Author SHA1 Message Date
Martin Habovštiak
d9d6cea5a9
Make json require string and pass around metadata ()
* Make json require string and pass around metadata

The json deserializer was accepting any inputs by coercing non-strings
into strings. As an example, if the input was `[1, 2]` the coercion
would turn into `[12]` and deserialize as a list containing number
twelve instead of a list of two numbers, one and two. This could lead
to silent data corruption.

Aside from that pipeline metadata wasn't passed aroud.

This commit fixes the type issue by adding a strict conversion
function that errors if the input type is not a string or external
stream. It then uses this function instead of the original
`collect_string()`. In addition, this function returns the pipeline
metadata so it can be passed along.

* Make other formats require string

The problem with json coercing non-string types to string was present in
all other text formats. This reuses the `collect_string_strict` function
to fix them.

* `IntoPipelineData` cleanup

The method `into_pipeline_data_with_metadata` can now be conveniently
used.
2022-11-20 17:06:09 -08:00
Dan Davison
df94052180
Declare input and output types of commands ()
* Add failing test that list of ints and floats is List<Number>

* Start defining subtype relation

* Make it possible to declare input and output types for commands

- Enforce them in tests

* Declare input and output types of commands

* Add formatted signatures to `help commands` table

* Revert SyntaxShape::Table -> Type::Table change

* Revert unnecessary derive(Hash) on SyntaxShape

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-11-10 10:55:05 +13:00
JT
76079d5183
Move config to be an env var ()
* Move config to be an env var

* fix fmt and tests
2022-04-19 10:28:01 +12:00
JT
3522bead97
Add string stream and binary stream, add text decoding ()
* WIP

* Add binary/string streams and text decoding

* Make string collection fallible

* Oops, forgot pretty hex

* Oops, forgot pretty hex

* clippy
2021-12-24 18:22:11 +11:00
JT
2883d6cd1e
Remove Span::unknown () 2021-12-19 18:46:13 +11:00
JT
2013e9300a
Make config default if broken ()
* Make config default if broken

* Make config default if broken
2021-12-13 14:16:51 +11:00
Luccas Mateus
8043516d75
from vcf from ics and from ini ()
* MathEval Variance and Stddev

* Fix tests and linting

* Typo

* Deal with streams when they are not tables

* `from toml` command

* From ods

* From XLSX

* From ics

* From ini

* From vcf

* Forgot a eprintln!
2021-11-26 06:10:56 +13:00