Commit Graph

518 Commits

Author SHA1 Message Date
b54ce921dd Better error messages. 2019-10-31 04:36:08 -05:00
81691e07c6 Add prepend and append commands 2019-10-30 19:54:06 +13:00
3820fef801 Add a simple read/parse plugin to better handle text data 2019-10-30 11:33:36 +13:00
392ff286b2 This commit is ongoing work for making Nu working with data processing
a joy. Fundamentally we embrace functional programming principles for
transforming the dataset from any format picked up by Nu. This table
processing "primitive" commands will build up and make pipelines
composable with data processing capabilities allowing us the valuate,
reduce, and map, the tables as far as even composing this declartively.

On this regard, `split-by` expects some table with grouped data and we
can use it further in interesting ways (Eg. collecting labels for
visualizing the data in charts and/or suit it for a particular chart
of our interest).
2019-10-29 16:04:31 -05:00
571b33a11c Merge pull request #857 from andrasio/group-by
Can group rows by given column name.
2019-10-23 18:25:52 +13:00
f1630da2cc Suggest a column name in case one unknown column is supplied. 2019-10-22 20:10:42 -05:00
6a7c00eaef Finish the job of moving shapes into the stream
This commit should finish the `coloring_in_tokens` feature, which moves
the shape accumulator into the token stream. This allows rollbacks of
the token stream to also roll back any shapes that were added.

This commit also adds a much nicer syntax highlighter trace, which shows
all of the paths the highlighter took to arrive at a particular coloring
output. This change is fairly substantial, but really improves the
understandability of the flow. I intend to update the normal parser with
a similar tracing view.

In general, this change also fleshes out the concept of "atomic" token
stream operations.

A good next step would be to try to make the parser more
error-correcting, using the coloring infrastructure. A follow-up step
would involve merging the parser and highlighter shapes themselves.
2019-10-22 16:19:22 -07:00
a317072e4e Cover failure not found files cases. 2019-10-22 08:08:24 -05:00
0611f56776 Can group cells by given column name. 2019-10-20 18:42:07 -05:00
9eda573a43 filter out the files that have the same size on multiple operating systems 2019-10-18 20:43:37 -04:00
4f91d2512a add a test to calculate average of bytes 2019-10-18 20:43:37 -04:00
43fbf4345d remove comment and add test for averaging integers 2019-10-18 20:43:37 -04:00
0d2044e72e Changes flag to minimum-spaces. 2019-10-15 22:05:32 +02:00
e7b37bee08 Adds filter test for named param. 2019-10-15 20:58:46 +02:00
ec2e35ad81 'last' gets last row if no amount desired given. 2019-10-15 05:41:34 -05:00
5ed1ed54a6 Move off 'sum' to internal command 'count' for tests. 2019-10-15 05:16:47 -05:00
3f60c9d416 'first' gets first row if no amount desired given. 2019-10-15 04:17:55 -05:00
bd6d8189f8 Merge pull request #830 from t-hart/pull-req/from-master
[DRAFT] Adds `from-ssv` command.
2019-10-15 18:28:43 +13:00
65546646a7 Pull in upstream changes. 2019-10-14 23:05:52 +02:00
ee8cd671cb Fix bug with multiple input objects to an external command.
Previously, we would build a command that looked something like this:

  <ex_cmd> "$it" "&&" "<ex_cmd>" "$it"

So that the "&&" and "<ex_cmd>" would also be arguments to the command,
instead of a chained command. This commit builds up a command string
that can be passed to an external shell.
2019-10-14 16:47:12 -04:00
de1c4e6c88 Implements from-ssv 2019-10-13 22:50:45 +02:00
648d4865b1 Adds unimplemented module, tests. 2019-10-13 21:15:30 +02:00
193b00764b Stream support (#812)
* Moves off of draining between filters. Instead, the sink will pull on the stream, and will drain element-wise. This moves the whole stream to being lazy.
* Adds ctrl-c support and connects it into some of the key points where we pull on the stream. If a ctrl-c is detect, we immediately halt pulling on the stream and return to the prompt.
* Moves away from having a SourceMap where anchor locations are stored. Now AnchorLocation is kept directly in the Tag.
* To make this possible, split tag and span. Span is largely used in the parser and is copyable. Tag is now no longer copyable.
2019-10-13 17:12:43 +13:00
1ad9d6f199 Overhaul the expansion system
The main thrust of this (very large) commit is an overhaul of the
expansion system.

The parsing pipeline is:

- Lightly parse the source file for atoms, basic delimiters and pipeline
  structure into a token tree
- Expand the token tree into a HIR (high-level intermediate
  representation) based upon the baseline syntax rules for expressions
  and the syntactic shape of commands.

Somewhat non-traditionally, nu doesn't have an AST at all. It goes
directly from the token tree, which doesn't represent many important
distinctions (like the difference between `hello` and `5KB`) directly
into a high-level representation that doesn't have a direct
correspondence to the source code.

At a high level, nu commands work like macros, in the sense that the
syntactic shape of the invocation of a command depends on the
definition of a command.

However, commands do not have the ability to perform unrestricted
expansions of the token tree. Instead, they describe their arguments in
terms of syntactic shapes, and the expander expands the token tree into
HIR based upon that definition.

For example, the `where` command says that it takes a block as its first
required argument, and the description of the block syntactic shape
expands the syntax `cpu > 10` into HIR that represents
`{ $it.cpu > 10 }`.

This commit overhauls that system so that the syntactic shapes are
described in terms of a few new traits (`ExpandSyntax` and
`ExpandExpression` are the primary ones) that are more composable than
the previous system.

The first big win of this new system is the addition of the `ColumnPath`
shape, which looks like `cpu."max ghz"` or `package.version`.
Previously, while a variable path could look like `$it.cpu."max ghz"`,
the tail of a variable path could not be easily reused in other
contexts. Now, that tail is its own syntactic shape, and it can be used
as part of a command's signature.

This cleans up commands like `inc`, `add` and `edit` as well as
shorthand blocks, which can now look like `| where cpu."max ghz" > 10`
2019-10-10 08:27:51 -07:00
837d12decd Filesystem shell can't cd into files. Ever. 2019-09-24 15:34:30 -05:00
5ff94004c6 Add urlencode/urldecode 2019-09-19 16:25:29 +12:00
91bea7fb2a Assert the column is unknown.
did you mean in error messages appear when `get`ing unknown columns. Here we know the column does not exist so we check the exact error message.
2019-09-14 14:53:31 -05:00
19767ad551 Taking another stab at replacing Span with Tag 2019-09-14 11:48:45 -05:00
074a76c9d4 Fix test 2019-09-13 15:48:32 +12:00
7838dac689 first and get coverage. 2019-09-12 05:22:58 -05:00
c57c0eb371 pass lint checks. 2019-09-12 01:49:01 -05:00
b35549adac Removes regex crate dependency. 2019-09-11 22:20:42 -05:00
127381497c run rustfmt 2019-09-11 10:36:50 -04:00
ba8383ae2f to-[csv/tsv] fixes. 2019-09-10 07:00:25 -05:00
f61144006f config test harness. 2019-09-10 05:08:01 -05:00
f770409a60 cd '-' valueshell implementation and valueshell refactorings. 2019-09-08 05:40:47 -05:00
77c2e4200e Filesystem cd refactor/cleanup. 2019-09-08 04:55:49 -05:00
df9ff44956 Filesystem change directory coverage. 2019-09-08 03:09:05 -05:00
eecda3ecba Merge pull request #363 from twe4ked/cd-back
Implement `cd -` to return to the previous directory
2019-09-08 01:00:32 -05:00
159cf27e39 Implement cd - to return to the last path for the FilesystemShell 2019-09-08 15:10:46 +10:00
9da896ad4e Attempt so simplify classified 2019-09-08 14:00:04 +12:00
84628f298d Finish fixing failing tests. 2019-09-08 13:35:02 +12:00
39fce1191f Fix typo 2019-09-04 13:38:17 -04:00
e8764911cb Add comments for sample.{bson,db} 2019-09-04 13:36:12 -04:00
479f0a566e Covert to_* commands to work on whole table 2019-09-04 18:48:40 +12:00
05e858fa94 Add test 2019-09-03 22:37:26 -04:00
cf0efb811e Trim trailing whitespace and set it in editorconfig 2019-09-03 02:52:52 +02:00
9488c41dcd can embed a new field to the table 2019-09-02 00:37:13 -05:00
ca0c6eaf58 This commit introduces a basic help feature. We can go to it
with the `help` command to explore and list all commands available.

Enter will also try to see if the location to be entered is an existing
Nu command, if it is it will let you inspect the command under `help`.

This provides baseline needed so we can iterate on it.
2019-08-31 19:06:11 -05:00
b514d93ffd Add Decimal to sample.bson 2019-08-31 19:15:48 +02:00