Commit Graph

70 Commits

Author SHA1 Message Date
Andrés N. Robalino
f93ff9ec33
Make grouping more flexible. (#1741) 2020-05-09 12:15:47 -05:00
Jonathan Turner
b37e420c7c
Add with-env command (#1717) 2020-05-06 15:56:31 +12:00
Jonathan Turner
a9968046ed
Add subcommands. Switch from-* and to-* to them (#1708) 2020-05-04 20:44:33 +12:00
Andrés N. Robalino
cf53264438
Table operating commands. (#1686)
* Table operating commands.

* Updated merge test for clarity.

* More clarity.

* Better like this..
2020-04-29 23:18:24 -05:00
Jonathan Turner
db8219e798
extend it-expansion to externals (#1682)
* extend it-expansion to externals

* trim the carriage return for external strings
2020-04-30 07:09:14 +12:00
Jonathan Turner
73d5310c9c
make it-expansion work through blocks when necessary (#1681) 2020-04-29 19:51:46 +12:00
Jonathan Turner
8bd3cedce1
It expansion (#1668)
* First step in it-expansion

* Fix tests

* fix clippy warnings
2020-04-27 14:04:54 +12:00
Andrés N. Robalino
80025ea684
Rows and values can be checked for emptiness. Allows to set a value if desired. (#1665) 2020-04-26 12:30:52 -05:00
Jonathan Turner
ad7a3fd908
Add not-in: operator (#1661) 2020-04-26 17:32:17 +12:00
Thomas B Homburg
716c4def03
Add key_timeout config option (#1649) 2020-04-25 05:28:38 +12:00
Jonathan Turner
d7bd77829f
Bump rustyline (#1644)
* Bump rustyline

* Fix new clippy warnings

* Add pipeline command
2020-04-24 08:00:49 +12:00
Jonathan Turner
c7e11a5a28
bump to 0.13.0 (#1625) 2020-04-21 17:01:03 +12:00
Jonathan Turner
e4fdb36511
External vars (#1615)
* fix empty table and missing spans

* wip

* WIP

* WIP

* working version with vars

* tidying

* WIP

* Fix external quoting issue
2020-04-21 09:45:11 +12:00
Jonathan Turner
2ffb14c7d0
fix empty table and missing spans (#1614) 2020-04-20 19:44:19 +12:00
Jonathan Turner
eec94e4016
Semicolon (#1613)
* WIP on blocks

* Getting further

* add some tests
2020-04-20 18:41:51 +12:00
Jason Gedge
522a828687
Move external closer to internal (#1611)
* Refactor InputStream and affected commands.

First, making `values` private and leaning on the `Stream` implementation makes
consumes of `InputStream` less likely to have to change in the future, if we
change what an `InputStream` is internally.

Second, we're dropping `Option<InputStream>` as the input to pipelines,
internals, and externals. Instead, `InputStream.is_empty` can be used to check
for "emptiness". Empty streams are typically only ever used as the first input
to a pipeline.

* Add run_external internal command.

We want to push external commands closer to internal commands, eventually
eliminating the concept of "external" completely. This means we can consolidate
a couple of things:

- Variable evaluation (for example, `$it`, `$nu`, alias vars)
- Behaviour of whole stream vs per-item external execution

It should also make it easier for us to start introducing argument signatures
for external commands,

* Update run_external.rs

* Update run_external.rs

* Update run_external.rs

* Update run_external.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-04-20 15:30:44 +12:00
Jonathan Turner
a16a91ede8
Fix precedence parsing of parens. Limit use (#1606) 2020-04-19 06:39:06 +12:00
Jonathan Turner
7974e09eeb
Math operators (#1601)
* Add some math operations

* WIP for adding compound expressions

* precedence parsing

* paren expressions

* better lhs handling

* add compound comparisons and shorthand lefthand parsing

* Add or comparison and shorthand paths
2020-04-18 13:50:58 +12:00
Jonathan Turner
bd5836e25d
Aliases (#1589)
* WIP getting scopes right

* finish adding initial support

* Finish with alias and add startup commands
2020-04-15 17:43:23 +12:00
Jonathan Turner
08a09e2273
Pipeline blocks (#1579)
* Making Commands match what UntaggedValue needs

* WIP

* WIP

* WIP

* Moved to expressions for conditions

* Add 'each' command to use command blocks

* More cleanup

* Add test for 'each'

* Instead use an expression block
2020-04-13 19:59:57 +12:00
Jonathan Turner
2c513d1883
More dep bumps (#1562) 2020-04-09 10:28:20 +12:00
Jonathan Turner
04702530a3
Bump a lot of deps (#1560) 2020-04-07 19:51:17 +12:00
Jonathan Turner
c4daa2e40f
Add experimental new parser (#1554)
Move to an experimental new parser
2020-04-06 19:16:14 +12:00
Jonathan Turner
791f7dd9c3
Bump to 0.12.0 (#1538) 2020-04-01 06:25:21 +13:00
Corvus Corax
a4c1b092ba
Add configurations for table headers (#1537)
* Add configurations for table headers

* lint

Co-authored-by: Amanita-Muscaria <nope>
2020-03-31 12:19:48 +13:00
Andrés N. Robalino
21a543a901
Make sum plugin as internal command. (#1501) 2020-03-18 18:46:00 -05:00
Jonathan Turner
62666bebc9
Bump to 0.11.0 (#1474) 2020-03-11 06:34:19 +13:00
Jason Gedge
755d0e648b
Eliminate some compiler warnings (#1468)
- Unnecessary parentheses
- Deprecated `description()` method
2020-03-09 08:19:07 +13:00
Jason Gedge
01dd358a18
Don't emit a newline in autoview. (#1466)
The extra newline character makes it hard to use nu as part of an
external processing pipeline, since the extra character could taint the
results. For example:

```
$ nu -c 'echo test | xxd'
00000000: 7465 7374                                test
```

versus

```
nu -c 'echo test' | xxd
00000000: 7465 7374 0a                             test.
```
2020-03-09 08:18:24 +13:00
Jonathan Turner
50fb97f6b7
Merge env into $nu and simplify table/get (#1463) 2020-03-08 18:33:30 +13:00
Andrés N. Robalino
c731a5b628
Columns can be renamed. (#1447) 2020-03-03 16:01:24 -05:00
Jonathan Turner
0f7c723672
Bump version to 0.10.0 (#1403) 2020-02-18 16:56:09 +13:00
Corvus Corax
0961da406d
Add string to datetime to str plugin (#1381)
* Add string to datetime to str plugin

* Test string to date/time conversion
2020-02-13 07:47:04 -08:00
Corvus Corax
c0be02a434
Short-hand flags (#1378)
* typo fixes

* Change signature to take in short-hand flags

* update help information

* Parse short-hand flags as their long counterparts

* lints

* Modified a couple tests to use shorthand flags
2020-02-11 18:24:31 -08:00
Jonathan Turner
763fcbc137
Bump to 0.9.0 (#1297) 2020-01-29 15:17:02 +13:00
Andrés N. Robalino
9b4ba09c95
Nu env vars from config have higher priority. (#1294) 2020-01-28 02:10:15 -05:00
Andrés N. Robalino
caa6830184
Baseline environment and configuration work. (#1287) 2020-01-27 22:13:22 -05:00
Jason Gedge
32dfb32741 Switch from subprocess crate to the builtin std::process (#1284)
* Switch from subprocess crate to the builtin std::process

* Update external.rs

* Update external.rs

* Update external.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-01-26 16:03:21 +13:00
Corvus Corax
d48f99cb0e compute directory sizes from contained files and directories (#1250)
* compute directory sizes from contained files and directories

* De-lint

* Revert "De-lint"

This reverts commit 9df9fc07d777014fef8f5749a84b4e52e1ee652a.

* Revert "compute directory sizes from contained files and directories"

This reverts commit d43583e9aa20438bd613f78a36e641c9fd48cae3.

* Nu du command

* Nu du for you

* Add async support

* Lints

* so much bug fixing
2020-01-26 15:43:29 +13:00
Corvus Corax
a5e1372bc2 RM error on bad filename (#1244)
* rm error on bad filename

* De-lint

* Fix error message in test
2020-01-25 08:16:41 +13:00
Andrés N. Robalino
fe4ad5f77e
Color named type help especial case. (#1263)
Refactored out help named type as switch.
2020-01-22 19:36:48 -05:00
Yehuda Katz
7efb31a4e4 Restructure and streamline token expansion (#1123)
Restructure and streamline token expansion

The purpose of this commit is to streamline the token expansion code, by
removing aspects of the code that are no longer relevant, removing
pointless duplication, and eliminating the need to pass the same
arguments to `expand_syntax`.

The first big-picture change in this commit is that instead of a handful
of `expand_` functions, which take a TokensIterator and ExpandContext, a
smaller number of methods on the `TokensIterator` do the same job.

The second big-picture change in this commit is fully eliminating the
coloring traits, making coloring a responsibility of the base expansion
implementations. This also means that the coloring tracer is merged into
the expansion tracer, so you can follow a single expansion and see how
the expansion process produced colored tokens.

One side effect of this change is that the expander itself is marginally
more error-correcting. The error correction works by switching from
structured expansion to `BackoffColoringMode` when an unexpected token
is found, which guarantees that all spans of the source are colored, but
may not be the most optimal error recovery strategy.

That said, because `BackoffColoringMode` only extends as far as a
closing delimiter (`)`, `]`, `}`) or pipe (`|`), it does result in
fairly granular correction strategy.

The current code still produces an `Err` (plus a complete list of
colored shapes) from the parsing process if any errors are encountered,
but this could easily be addressed now that the underlying expansion is
error-correcting.

This commit also colors any spans that are syntax errors in red, and
causes the parser to include some additional information about what
tokens were expected at any given point where an error was encountered,
so that completions and hinting could be more robust in the future.

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
Co-authored-by: Andrés N. Robalino <andres@androbtech.com>
2020-01-21 17:45:03 -05:00
Jonathan Turner
3abfefc025
More docs and random fixes (#1237) 2020-01-19 08:42:36 +13:00
Corvus Corax
a5c5b4e711 Add --help for commands (#1226)
* WIP --help works for PerItemCommands.

* De-linting

* Add more comments (#1228)

* Add some more docs

* More docs

* More docs

* More docs (#1229)

* Add some more docs

* More docs

* More docs

* Add more docs

* External commands: wrap values that contain spaces in quotes (#1214) (#1220)

* External commands: wrap values that contain spaces in quotes (#1214)

* Add fn's argument_contains_whitespace & add_quotes (#1214)

*  Fix formatting with cargo fmt

* Don't wrap argument in quotes when $it is already quoted (#1214)

* Implement --help for internal commands

* Externals now spawn independently. (#1230)

This commit changes the way we shell out externals when using the `"$it"` argument. Also pipes per row to an external's stdin if no `"$it"` argument is present for external commands. 

Further separation of logic (preparing the external's command arguments, getting the data for piping, emitting values, spawning processes) will give us a better idea for lower level details regarding external commands until we can find the right abstractions for making them more generic and unify within the pipeline calling logic of Nu internal's and external's.

* Poll externals quicker. (#1231)

* WIP --help works for PerItemCommands.

* De-linting

* Implement --help for internal commands

* Make having --help the default

* Update test to include new default switch

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
Co-authored-by: Koenraad Verheyden <mail@koenraadverheyden.com>
Co-authored-by: Andrés N. Robalino <andres@androbtech.com>
2020-01-18 11:46:18 +13:00
Jonathan Turner
e2e9abab0a
More docs (#1229)
* Add some more docs

* More docs

* More docs

* Add more docs
2020-01-16 07:32:46 +13:00
Jonathan Turner
2956b0b087
Add more comments (#1228)
* Add some more docs

* More docs

* More docs
2020-01-16 05:28:31 +13:00
Jonathan Turner
b32eceffb3
Add some comments (#1225) 2020-01-14 20:38:56 +13:00
Jonathan Turner
02d0a4107e
A few ls improvements. New welcome message (#1195) 2020-01-12 09:49:20 +13:00
Jonathan Turner
41ebc6b42d
Bump to 0.8.0 (#1166) 2020-01-07 20:08:31 +13:00
Jonathan Turner
77d856fd53
Last unwraps (#1160)
* Work through most of the last unwraps

* Finish removing unwraps
2020-01-04 19:44:17 +13:00