Commit Graph

2034 Commits

Author SHA1 Message Date
Andrés N. Robalino
762c798670
It ls test setup rewrite. (#1260) 2020-01-21 22:56:12 -05:00
Andrés N. Robalino
3c01526869
Test binaries no longer belong to stable or default features. (#1259) 2020-01-21 22:00:27 -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
c8dd7838a8
Bump Pipeline images (#1255)
* Bump Pipeline images

* Update azure-pipelines.yml

* Update azure-pipelines.yml
2020-01-22 10:39:31 +13:00
Sean Hellum
3b57ee5dda Add internal clear command (#1249)
* Add clear.rs

* update

* update

* cross-platformify

* update

* fix

* format

* fix warnings

* update implementation

* remove return

* remove semicolon

* change from `.output()` to `.status()`

* format
2020-01-20 20:05:32 +13:00
Sean Hellum
fb977ab941 add automated setup badge and add .gitpod.yml patch (#1246)
* add automated setup badge and add .gitpod.yml patch

* Update .gitpod.yml
2020-01-20 14:40:04 +13:00
Koenraad Verheyden
e059c74a06 Add support for primitive values to sort-by (#1241)
* Remove redundant clone

* Add support for primitive values to sort-by #1238
2020-01-20 08:08:36 +13:00
Jason Gedge
47d987d37f Add ctrl_c to RunnablePerItemContext. (#1239)
Also, this commit makes `ls` a per-item command.

A command that processes things item by item may still take some time to stream
out the results from a single item. For example, `ls` on a directory with a lot
of files could be interrupted in the middle of showing all of these files.
2020-01-19 15:25:07 +13: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
ba9cb753d5
Bump some of our dependencies (#1234) 2020-01-18 09:35:48 +13:00
Andrés N. Robalino
ba7a1752db
Poll externals quicker. (#1231) 2020-01-16 06:27:12 -05:00
Andrés N. Robalino
29431e73c2
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.
2020-01-16 04:05:53 -05:00
Koenraad Verheyden
d29fe6f6de 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)
2020-01-16 13:38:16 +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
Corvus Corax
3adf52b1c4 update .gitignore to exclude target directories in the crate directory (#1221) 2020-01-14 20:14:24 +13:00
Andrés N. Robalino
78a644da2b
Restrict Nu with a cleaned environment. (#1222) 2020-01-13 23:17:20 -05:00
Koenraad Verheyden
98028433ad $it: add conversion from Int for external commands (#1218) 2020-01-13 18:57:44 -05:00
Koenraad Verheyden
2ab5803f00 $it: add conversion from Path for external commands (#1210)
* $it: add conversion from Path for external commands (#1203)

* Replace PathBuf::to_str with to_string_lossy
2020-01-14 05:41:18 +13:00
Jason Gedge
65980c7beb Revert 8cadc5a4 (#1211) 2020-01-13 19:38:58 +13:00
Andrés N. Robalino
29fd8b55fb
Keep dummies in default features for convenience. (#1212) 2020-01-13 01:17:56 -05:00
Corvus Corax
2f039b3abc Fix crash when attempting to enter help shell (#1201)
`enter help` would result in a crash
2020-01-13 17:27:00 +13:00
Andrés N. Robalino
d3dae05714
Groundwork for coverage with Nu internals. (#1205) 2020-01-12 16:44:22 -05:00
Jonathan Turner
5fd3191d91
Fix randomly failing test (#1200)
* Fix randomly failing test

* Fix randomly failing test
2020-01-13 06:03:28 +13:00
Andrés N. Robalino
0dcd90cb8f
Silence stdout for test runs. (#1198) 2020-01-12 04:14:10 -05:00
Jonathan Turner
02d0a4107e
A few ls improvements. New welcome message (#1195) 2020-01-12 09:49:20 +13:00
Jonathan Turner
63885c4ee6
Change black to other colors (#1194) 2020-01-12 06:21:59 +13:00
Jonathan Turner
147bfefd7e
Sort ls case-insensitively by default (#1192) 2020-01-11 20:59:55 +13:00
Andrés N. Robalino
60043df917
Allow ColumnPaths when picking tables. (#1191) 2020-01-11 01:45:09 -05:00
Andrés N. Robalino
6d3a30772d
Get error message improvements. (#1185)
More especific "get" command error messages + Test refactoring.
2020-01-10 10:44:24 -05:00
Jason Gedge
347f91ab53 Have internal/external/pipelines taken an optional InputStream. (#1182)
Primarily, this fixes an issue where we always open a stdin pipe for
external commands, which can break various interactive commands (e.g.,
editors).
2020-01-09 22:31:44 -08:00
Jonathan Turner
5692a08e7f
Update README.md 2020-01-10 09:40:30 +13:00
Jonathan Turner
515a3b33f8
Thin-lines for tables for better rendering (#1181)
The thick lines are pretty subtle and some fonts have issues with it. Seems keeping the lines consistent works better across fonts.
2020-01-09 12:33:02 -08:00
Alex
c3e466e464 Make debug command always prettty-print (Resolves #1178) (#1180) 2020-01-09 11:24:21 -08:00
Andrés N. Robalino
00c0327031
Support more Values to plain string. (#1169)
* Support more Values to plain string.

* Continue converting to delimited data for simple values.
2020-01-08 06:12:59 -05:00
Jason Gedge
7451414b9e Eliminate ClassifiedInputStream in favour of InputStream. (#1056) 2020-01-07 13:00:01 -08:00
Jonathan Turner
41ebc6b42d
Bump to 0.8.0 (#1166) 2020-01-07 20:08:31 +13:00
Shaurya Shubham
b574dc6365 Add the from-ods command (#1161)
* Put a sample_data.ods file for testing

This is a copy of the sample_data.xlsx file but in ods format

* Add the from-ods command

Most of the work was doing `rg xlsx` and then copy/paste with light editing

* Add tests for the from-ods command

* Fix failing test

The problem was improper filename sorting in the test `prepares_and_decorates_filesystem_source_files`
2020-01-07 19:35:00 +13:00
Alex
4af9e1de41 Resolves #750 (#1164)
Pick now produces an error when none of the columns are found
2020-01-07 17:06:48 +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
Andrés N. Robalino
6dceabf389
Isolate data processing helpers. (#1159)
Isolate data processing helpers. Remove unwraps and down to zero unwraps.
2020-01-03 23:00:39 -05:00
Jonathan Turner
5919c6c433
Remove unwraps (#1153)
* Remove a batch of unwraps

* finish another batch
2020-01-04 10:11:21 +13:00
Jonathan Turner
339a2de0eb
More ununwraps (#1152)
* More ununwraps

* More ununwraps

* Update completer.rs

* Update completer.rs
2020-01-03 06:51:20 +13:00
Jonathan Turner
3e3cb15f3d
Yet more ununwraps (#1150) 2020-01-02 20:07:17 +13:00
Jonathan Turner
5e31851070
A couple more (#1149) 2020-01-02 18:24:41 +13:00
Jonathan Turner
0f626dd076
Another batch of un-unwrapping (#1148)
Another batch of un-unwrappings
2020-01-02 17:02:46 +13:00
Jonathan Turner
aa577bf9bf
Clean up some unwraps (#1147) 2020-01-02 09:45:32 +13:00
Jonathan Turner
25298d35e4
Bump rustyline (#1146)
* Slightly improve new which command

* Bump rustyline
2020-01-02 06:54:25 +13:00