Commit Graph

157 Commits

Author SHA1 Message Date
notryanb@gmail.com
43fbf4345d remove comment and add test for averaging integers 2019-10-18 20:43:37 -04:00
Thomas Hartmann
0d2044e72e Changes flag to minimum-spaces. 2019-10-15 22:05:32 +02:00
Thomas Hartmann
e7b37bee08 Adds filter test for named param. 2019-10-15 20:58:46 +02:00
Andrés N. Robalino
ec2e35ad81 'last' gets last row if no amount desired given. 2019-10-15 05:41:34 -05:00
Andrés N. Robalino
5ed1ed54a6 Move off 'sum' to internal command 'count' for tests. 2019-10-15 05:16:47 -05:00
Andrés N. Robalino
3f60c9d416 'first' gets first row if no amount desired given. 2019-10-15 04:17:55 -05:00
Jonathan Turner
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
Thomas Hartmann
65546646a7 Pull in upstream changes. 2019-10-14 23:05:52 +02:00
Jason Gedge
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
Thomas Hartmann
de1c4e6c88 Implements from-ssv 2019-10-13 22:50:45 +02:00
Thomas Hartmann
648d4865b1 Adds unimplemented module, tests. 2019-10-13 21:15:30 +02:00
Jonathan Turner
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
Yehuda Katz
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
Andrés N. Robalino
837d12decd Filesystem shell can't cd into files. Ever. 2019-09-24 15:34:30 -05:00
Jonathan Turner
5ff94004c6 Add urlencode/urldecode 2019-09-19 16:25:29 +12:00
Andrés N. Robalino
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
Yehuda Katz
19767ad551 Taking another stab at replacing Span with Tag 2019-09-14 11:48:45 -05:00
Jonathan Turner
074a76c9d4 Fix test 2019-09-13 15:48:32 +12:00
Andrés N. Robalino
7838dac689 first and get coverage. 2019-09-12 05:22:58 -05:00
Andrés N. Robalino
c57c0eb371 pass lint checks. 2019-09-12 01:49:01 -05:00
Andrés N. Robalino
b35549adac Removes regex crate dependency. 2019-09-11 22:20:42 -05:00
Maximilian Roos
127381497c
run rustfmt 2019-09-11 10:36:50 -04:00
Andrés N. Robalino
ba8383ae2f to-[csv/tsv] fixes. 2019-09-10 07:00:25 -05:00
Andrés N. Robalino
f61144006f config test harness. 2019-09-10 05:08:01 -05:00
Andrés N. Robalino
f770409a60 cd '-' valueshell implementation and valueshell refactorings. 2019-09-08 05:40:47 -05:00
Andrés N. Robalino
77c2e4200e Filesystem cd refactor/cleanup. 2019-09-08 04:55:49 -05:00
Andrés N. Robalino
df9ff44956 Filesystem change directory coverage. 2019-09-08 03:09:05 -05:00
Andrés N. Robalino
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
Odin Dutton
159cf27e39 Implement cd - to return to the last path for the FilesystemShell 2019-09-08 15:10:46 +10:00
Jonathan Turner
9da896ad4e Attempt so simplify classified 2019-09-08 14:00:04 +12:00
Jonathan Turner
84628f298d Finish fixing failing tests. 2019-09-08 13:35:02 +12:00
Patrick Meredith
39fce1191f Fix typo 2019-09-04 13:38:17 -04:00
Patrick Meredith
e8764911cb Add comments for sample.{bson,db} 2019-09-04 13:36:12 -04:00
Jonathan Turner
479f0a566e Covert to_* commands to work on whole table 2019-09-04 18:48:40 +12:00
Patrick Meredith
05e858fa94 Add test 2019-09-03 22:37:26 -04:00
est31
cf0efb811e Trim trailing whitespace and set it in editorconfig 2019-09-03 02:52:52 +02:00
Andrés N. Robalino
9488c41dcd can embed a new field to the table 2019-09-02 00:37:13 -05:00
Andrés N. Robalino
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
Patrick Meredith
b514d93ffd Add Decimal to sample.bson 2019-08-31 19:15:48 +02:00
Patrick Meredith
3d147d1143 Add SQLite support 2019-08-30 20:54:45 -04:00
Andrés N. Robalino
f1e8c433c2 [from/to]tsv support. 2019-08-29 04:02:16 -05:00
Andrés N. Robalino
9810df25b4 Readability improvement. 2019-08-29 01:31:56 -05:00
Andrés N. Robalino
4d2b0f43f5 Fix test. 2019-08-28 21:05:23 -05:00
Andrés N. Robalino
a07817e0e0 cover pipeline helper. 2019-08-28 20:30:51 -05:00
Andrés N. Robalino
55fb1f8dda Yo quiero Playground taconushell. 2019-08-28 19:32:42 -05:00
Yehuda Katz
f82cc4291f Migrate commands_test 2019-08-28 10:58:00 -07:00
Yehuda Katz
abac7cf746 Migrate rm 2019-08-28 10:48:52 -07:00
Yehuda Katz
2c65b2fc2f Migrate mv 2019-08-28 10:28:58 -07:00
Yehuda Katz
21ad06b1e1 Remove unwraps and clean up playground
The original intent of this patch was to remove more unwraps to reduce
panics. I then lost a ton of time to the fact that the playground isn't
in a temp directory (because of permissions issues on Windows).

This commit improves the test facilities to:

- use a tempdir for the playground
- change the playground API so you instantiate it with a block that
  encloses the lifetime of the tempdir
- the block is called with a `dirs` argument that has `dirs.test()` and
  other important directories that we were computing by hand all the time
- the block is also called with a `playground` argument that you can use
  to construct files (it's the same `Playground` as before)
- change the nu! and nu_error! macros to produce output instead of
  taking a variable binding
- change the nu! and nu_error! macros to do the cwd() transformation
  internally
- change the nu! and nu_error! macros to take varargs at the end that
  get interpolated into the running command

I didn't manage to finish porting all of the tests, so a bunch of tests
are currently commented out. That will need to change before we land
this patch.
2019-08-28 10:01:16 -07:00
Andrés N. Robalino
162c8b4274 swept clean quotes 2019-08-27 06:20:22 -05:00