Commit Graph

485 Commits

Author SHA1 Message Date
Jonathan Turner
6893850fce Move edit and insert to core 2019-12-06 09:15:41 +13:00
Jonathan Turner
d12c16a331 Extract ps and sys subcrates. Move helper methods to UntaggedValue 2019-12-05 08:52:31 +13:00
Sebastian Jung
ecebe1314a update to new crates structure 2019-12-03 20:56:39 +01:00
Sebastian Jung
bda5db59c8 Merge remote-tracking branch 'upstream/master' into range 2019-12-03 20:23:49 +01:00
Sebastian Jung
201506a5ad add tests for range + run rustfmt 2019-12-03 08:24:49 +01:00
Jonathan Turner
efc879b955 Add new line primitive, bump version, allow bare filepaths 2019-12-03 19:44:59 +13:00
Sebastian Jung
8390cc97e1 add range command 2019-12-02 20:15:14 +01:00
Yehuda Katz
4115634bfc Try to re-apply #1039 2019-12-02 11:02:58 -08:00
Yehuda Katz
a1e21828d6 Fix tests 2019-12-02 11:02:57 -08:00
Jonathan Turner
0f193c2337 Update histogram.rs 2019-12-02 11:02:57 -08:00
Yehuda Katz
f52c0655c7 expand tilde in externals
original: 9f42d7693f
2019-12-02 11:02:57 -08:00
Jason Gedge
4e9afd6698 Refactor classified.rs into separate modules.
Adds modules for internal, external, and dynamic commands, as well as
the pipeline functionality. These are exported as their old names from
the classified module so as to keep its "interface" the same.
2019-12-02 11:02:57 -08:00
Belhorma Bendebiche
8f9dd6516e Add =~ and !~ operators on strings
`left =~ right` return true if left contains right, using Rust's
`String::contains`. `!~` is the negated version.

A new `apply_operator` function is added which decouples evaluation from
`Value::compare`. This returns a `Value` and opens the door to
implementing `+` for example, though it wouldn't be useful immediately.

The `operator!` macro had to be changed slightly as it would choke on
`~` in arguments.
2019-12-02 11:02:57 -08:00
Yehuda Katz
e4226def16 Extract core stuff into own crates
This commit extracts five new crates:

- nu-source, which contains the core source-code handling logic in Nu,
  including Text, Span, and also the pretty.rs-based debug logic
- nu-parser, which is the parser and expander logic
- nu-protocol, which is the bulk of the types and basic conveniences
  used by plugins
- nu-errors, which contains ShellError, ParseError and error handling
  conveniences
- nu-textview, which is the textview plugin extracted into a crate

One of the major consequences of this refactor is that it's no longer
possible to `impl X for Spanned<Y>` outside of the `nu-source` crate, so
a lot of types became more concrete (Value became a concrete type
instead of Spanned<Value>, for example).

This also turned a number of inherent methods in the main nu crate into
plain functions (impl Value {} became a bunch of functions in the
`value` namespace in `crate::data::value`).
2019-12-02 10:54:12 -08:00
Jason Gedge
ac5543bad9 Move pipeline execution code into classified::Pipeline 2019-11-30 16:12:34 -05:00
Jonathan Turner
7a28ababd1
Update histogram.rs 2019-11-27 15:32:05 +13:00
Jonathan Turner
9f42d7693f expand tilde in externals 2019-11-27 06:34:02 +13:00
Yehuda Katz
2eae5a2a89 Merge remote-tracking branch 'origin/master' into cleanup-wip 2019-11-25 19:25:12 -08:00
Andrés N. Robalino
70d63e34e9
Merge pull request #1008 from thegedge/move-pipeline-to-classified
Move pipeline code from cli to classified
2019-11-25 18:21:07 -05:00
Andrés N. Robalino
d320ffe742 nth can select more than one row at a time. 2019-11-25 17:16:58 -05:00
Yehuda Katz
5fbea31d15 Remove unused Display implementations
After the previous commit, nushell uses PrettyDebug and
PrettyDebugWithSource for our pretty-printed display output.

PrettyDebug produces a structured `pretty.rs` document rather than
writing directly into a fmt::Formatter, and types that implement
`PrettyDebug` have a convenience `display` method that produces a string
(to be used in situations where `Display` is needed for compatibility
with other traits, or where simple rendering is appropriate).
2019-11-25 10:07:20 -08:00
Yehuda Katz
f70c6d5d48 Extract nu_source into a crate
This commit extracts Tag, Span, Text, as well as source-related debug
facilities into a new crate called nu_source.

This change is much bigger than one might have expected because the
previous code relied heavily on implementing inherent methods on
`Tagged<T>` and `Spanned<T>`, which is no longer possible.

As a result, this change creates more concrete types instead of using
`Tagged<T>`. One notable example: Tagged<Value> became Value, and Value
became UntaggedValue.

This change clarifies the intent of the code in many places, but it does
make it a big change.
2019-11-25 07:37:33 -08:00
Jason Gedge
71e7eb7cfc Move all pipeline execution code from cli to classified::pipeline 2019-11-24 22:52:37 -05:00
Jason Gedge
339ec46961 Refactor classified.rs into separate modules.
Adds modules for internal, external, and dynamic commands, as well as
the pipeline functionality. These are exported as their old names from
the classified module so as to keep its "interface" the same.
2019-11-24 17:19:12 -05:00
Andrés N. Robalino
06857fbc52 Take all rows having the column present. 2019-11-24 04:35:36 -05:00
Andrés N. Robalino
1c830b5c95 default command introduced. 2019-11-24 04:20:08 -05:00
Andrés N. Robalino
a74145961e Always check the row's columns. 2019-11-24 01:25:41 -05:00
Andrés N. Robalino
91698b2657
Merge pull request #1003 from andrasio/compact
Compact.
2019-11-23 22:03:20 -05:00
Jonathan Turner
4d5f1f6023 Revert some of the recent styled string changes 2019-11-24 13:56:19 +13:00
Andrés N. Robalino
bc2d65cd2e Remove raw data debugging. 2019-11-23 19:16:25 -05:00
Andrés N. Robalino
1a0b339897 compact command introduced. 2019-11-23 19:05:44 -05:00
Andrés N. Robalino
8d3a937413 Display raw debugging data (rust represetantion). 2019-11-23 18:53:50 -05:00
Andrés N. Robalino
c8aa8cb842 debug command facelift. 2019-11-22 03:31:58 -05:00
Yehuda Katz
cdb0eeafa2 --no-edit 2019-11-21 14:22:32 -08:00
David Mason
b3c021899c combine functions behind to/from-c/tsv commands
fixes #969, admittedly without a --delimiter alias

moves from_structured_data.rs to from_delimited_data.rs to better
identify its scope and adds to_delimited_data.rs. Now csv and tsv both
use the same code, tsv passes in a fixed '\t' argument where csv passes
in the value of --separator
2019-11-19 16:02:35 +00:00
Jonathan Turner
2bb03d9813 Abbreviate ls by default, add --full flag 2019-11-18 06:10:50 +13:00
Jonathan Turner
6231367bc8 Make duration its own primitive 2019-11-17 18:48:48 +13:00
Jonathan Turner
a7d7098b1a
Merge pull request #977 from jonathandturner/from_xls
Add from-xlsx for importing excel files
2019-11-17 16:36:22 +13:00
Jonathan Turner
90aeb700ea Add from_xlsx for importing excel files 2019-11-17 16:18:41 +13:00
Jonathan Turner
f992f5de95
Update save.rs 2019-11-17 14:13:52 +13:00
Belhorma Bendebiche
946f7256e4 Improve error messages for save
`save` attempts to convert input based on the target filename extension,
and expects a stream of text otherwise. However the error message is
unclear and provides little guidance, hopefully this is less confusing
to new users.

It might be worthwhile to also add a hint about adding an extension,
though I'm not sure if it's possible to emit multiple diagnostics.
2019-11-16 19:08:38 -05:00
Thomas Hartmann
1060ba2206 Fixes --headerless functionality for from-ssv.
Squashed commit of the following:

commit fc59d47a2291461d84e0587fc0fe63af0dc26f9f
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Tue Nov 12 15:39:38 2019 +0100

    Fixes inconsistencies in output.

commit da4084e9fdd983557b101207b381e333a443e551
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Tue Nov 12 13:04:10 2019 +0100

    remove unused enum.

commit 7f6a105879c8746786b99fb19bb9f0860c41796a
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Tue Nov 12 12:58:41 2019 +0100

    Starts refactoring from_ssv.

commit b70ddd169ef0c900e03fb590cb171cc7181528db
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Tue Nov 12 11:34:06 2019 +0100

    Fixes --headerless for non-aligned columns.

commit 6332778dd26de8d07be77b291124115141479892
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Tue Nov 12 10:27:35 2019 +0100

    Fixes from-ssv headerless aligned-columns logic.

commit 747d8c812e06349b4a15b8c130721881d86fff98
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Mon Nov 11 23:53:59 2019 +0100

    fixes unit tests for ssv.

commit c77cb451623b37a7a9742c791a4fc38cad053d3d
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Mon Nov 11 22:49:21 2019 +0100

    it compiles! one broken test.

commit 08a05964f56cf92507c255057d0aaf2b6dbb6f45
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Mon Nov 11 18:52:54 2019 +0100

    Backed into a corner. Help.

commit c95ab683025a8007b8a6f8e1659f021a002df584
Author: Thomas Hartmann <thomas.o.hartmann@gmail.com>
Date:   Mon Nov 11 17:30:54 2019 +0100

    broken but on the way
2019-11-12 16:04:55 +01:00
Thomas Hartmann
0401087175 Refactors out structured parsing logic to a separate module. 2019-11-12 16:04:55 +01:00
Thomas Hartmann
f8dc06ef49 Changes implementation of --headerless for from-tsv. 2019-11-12 16:04:55 +01:00
Thomas Hartmann
282cb46ff1 Implements --headerless for from-csv 2019-11-12 16:04:55 +01:00
Andrés N. Robalino
00b3c2036a This is part of on-going work with capabilities when working with
tables and able to work with them for data processing & viewing
purposes. At the moment, certain ways to process said tables we
are able to view a histogram of a given column.

As usage matures, we may find certain core commands that could
be used ergonomically when working with tables on Nu.
2019-11-12 03:39:30 -05:00
Andrés N. Robalino
3163b0d362 Data processing mvp histogram. 2019-11-12 02:08:28 -05:00
Andrés N. Robalino
21f48577ae Reductions placeholder. 2019-11-12 02:08:28 -05:00
David Mason
4a6122905b fmt: cargo fmt --all 2019-11-08 15:27:29 +00:00
David Mason
15986c598a Add --separator command to from_csv
The command takes a string, checks it is a single character and then
passes it to csv::ReaderBuilder via .delimiter() method as a u8.
2019-11-08 15:06:33 +00:00