Commit Graph

69 Commits

Author SHA1 Message Date
Jonathan Turner
8a9cdcab17 Split fetch command away from open 2019-09-03 18:04:46 +12:00
Jonathan Turner
abfd417430 Fix unwrap in open 2019-09-02 11:55:33 +12:00
est31
8504c7a8e6 Adopt field init shorthand in a few places
Found by running 'egrep "(\b[a-zA-Z]+): \1\b" -R src'
2019-09-01 23:39:59 +02: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
Jonathan Turner
1a67ac6102 Random fixes 2019-09-01 09:19:59 +12:00
Jonathan Turner
2cde4da43f Partially fix list support 2019-08-31 13:35:53 +12:00
Jonathan Turner
f730296e45 WIP supporting from/to automatically 2019-08-29 15:53:45 +12:00
Jonathan Turner
e0a13de943 Remove bind_by_move nightly feature 2019-08-29 14:44:08 +12:00
Yehuda Katz
34292b282a Add support for ~ expansion
This ended up being a bit of a yak shave. The basic idea in this commit is to
expand `~` in paths, but only in paths.

The way this is accomplished is by doing the expansion inside of the code that
parses literal syntax for `SyntaxType::Path`.

As a quick refresher: every command is entitled to expand its arguments in a
custom way. While this could in theory be used for general-purpose macros,
today the expansion facility is limited to syntactic hints.

For example, the syntax `where cpu > 0` expands under the hood to
`where { $it.cpu > 0 }`. This happens because the first argument to `where`
is defined as a `SyntaxType::Block`, and the parser coerces binary expressions
whose left-hand-side looks like a member into a block when the command is
expecting one.

This is mildly more magical than what most programming languages would do,
but we believe that it makes sense to allow commands to fine-tune the syntax
because of the domain nushell is in (command-line shells).

The syntactic expansions supported by this facility are relatively limited.
For example, we don't allow `$it` to become a bare word, simply because the
command asks for a string in the relevant position. That would quickly
become more confusing than it's worth.

This PR adds a new `SyntaxType` rule: `SyntaxType::Path`. When a command
declares a parameter as a `SyntaxType::Path`, string literals and bare
words passed as an argument to that parameter are processed using the
path expansion rules. Right now, that only means that `~` is expanded into
the home directory, but additional rules are possible in the future.

By restricting this expansion to a syntactic expansion when passed as an
argument to a command expecting a path, we avoid making `~` a generally
reserved character. This will also allow us to give good tab completion
for paths with `~` characters in them when a command is expecting a path.

In order to accomplish the above, this commit changes the parsing functions
to take a `Context` instead of just a `CommandRegistry`. From the perspective
of macro expansion, you can think of the `CommandRegistry` as a dictionary
of in-scope macros, and the `Context` as the compile-time state used in
expansion. This could gain additional functionality over time as we find
more uses for the expansion system.
2019-08-26 21:03:24 -07:00
Andrés N. Robalino
0e14ba86ae [from|to]csv additions/refactoring.
Introduced flag to tell `from-to` / `to-csv` whether we want headers parsed and/or written.
2019-08-25 12:32:08 -05:00
Patrick Meredith
a75c90cc42 Rebase on master 2019-08-25 10:16:22 -04:00
Patrick Meredith
a0f0372839 Add mostly working BSON support (missing some types) 2019-08-25 09:50:25 -04:00
Patrick Meredith
93a1a0604e Update how extensions are set to default to path when no extension can be determined from mime 2019-08-25 09:50:25 -04:00
Jonathan Turner
721a7b159d switch from reqwest to surf 2019-08-25 07:36:19 +12:00
Jonathan Turner
efd9631a90 All tests pass 2019-08-15 17:46:19 +12:00
Jonathan Turner
dd18122a24 WIP 2019-08-15 17:02:02 +12:00
Jonathan Turner
6cf3dc92fc Add support for utf16 files 2019-08-12 16:11:42 +12:00
Jonathan Turner
d07a3928b2 Fix test failure 2019-08-11 08:33:22 +12:00
Jonathan Turner
8f78995014 Improve enter and fix bugs 2019-08-11 08:18:14 +12:00
Jonathan Turner
eeed31837f cleanup 2019-08-10 08:49:43 +12:00
Jonathan Turner
aadacc2d36 Merge master 2019-08-09 16:51:21 +12:00
Jonathan Turner
c231dd32cd
Multi shells (#254)
Add multi-shells
2019-08-08 05:49:11 +12:00
Jonathan Turner
ae5b781159 More touchups to errors 2019-08-06 15:03:13 +12:00
Jonathan Turner
99671b8ffc Move more parts to tags and away from spans 2019-08-05 20:54:29 +12:00
Yehuda Katz
586aa6bae1 WIP - types check 2019-08-02 19:17:28 -07:00
Yehuda Katz
fc173c46d8 Restructuring 2019-08-02 12:15:07 -07:00
Jonathan Turner
462f783fac initial change to Tagged<Value> 2019-08-01 13:58:42 +12:00
Jonathan Turner
8ac70e7408 Various open improvements 2019-07-30 15:48:02 +12:00
Yehuda Katz
73deeb69db Clean up lint errors 2019-07-23 21:10:48 -07:00
Yehuda Katz
5a8e041a48 Tests pass! 2019-07-23 15:22:11 -07:00
Andrés N. Robalino
191dacdd8b Introduced conversion to csv command. 2019-07-21 02:08:05 -05:00
Jonathan Turner
c36c2a7b50 Switch from_csv to output rows 2019-07-20 18:44:21 +12:00
Jonathan Turner
15507f00fc Introduce CallInfo, which abstracts args, name_span, and source_map 2019-07-20 14:27:10 +12:00
Jonathan Turner
1e6a9b9b34 Merge branch 'master' into source_spans 2019-07-20 13:14:05 +12:00
Andrés N. Robalino
895a1b2d72 Introduced ability to open csv documents. 2019-07-19 15:48:42 -05:00
Jonathan Turner
d5d4da0bf8 Add first step of uuid generation and bookkeeping 2019-07-20 07:48:14 +12:00
Jonathan Turner
be69df86a9 Add more formats 2019-07-18 07:05:20 +12:00
Jonathan Turner
00b3106f05 Improve open URL. Format and remove warning in tests 2019-07-18 06:56:15 +12:00
Jonathan Turner
2ed46046bd Cleanup for upcoming release 2019-07-17 07:10:25 +12:00
Yehuda Katz
ded3462e82 Make signatures a little more general 2019-07-15 14:16:27 -07:00
Yehuda Katz
7c2a1c619e Tests pass 2019-07-12 19:20:26 -07:00
Yehuda Katz
2da12aed56 Tests pass 2019-07-12 19:20:26 -07:00
Yehuda Katz
7b68739b52 WIP 2019-07-12 19:20:26 -07:00
Yehuda Katz
71adfb4cdc WIP 2019-07-12 19:20:26 -07:00
Yehuda Katz
34033afce4 WIP improve error infrastructure
Also simplify commands and reduce papercuts
2019-07-12 19:20:26 -07:00
Jonathan Turner
65a0d27c8a Add binary type and tree sink 2019-07-04 17:11:56 +12:00
Jonathan Turner
75ddfe9f5a Add filter and sink plugins 2019-07-02 19:56:20 +12:00
Jonathan Turner
cfcf43ca93 Add content-type to open, refactor open/enter 2019-06-26 19:40:43 +12:00
Yehuda Katz
d0860837d2 Merge branch 'nom2' into nom4 2019-06-22 18:20:13 -04:00
Yehuda Katz
4036bf1ffd &str -> Text 2019-06-22 16:46:16 -04:00