Commit Graph

101 Commits

Author SHA1 Message Date
Jonathan Turner
60bfa277d0 Experiment with async/await-enabled ps 2019-08-31 07:07:07 +12:00
svartalf
213db54378 Update to heim v0.0.7. 2019-08-30 18:08:57 +03:00
Taiki Endo
58a32490c5 Remove usage of in_band_lifetimes feature 2019-08-30 01:32:31 +09:00
Jonathan Turner
f393938515
Merge pull request #531 from est31/no_specialization
Remove unused functions that use specialization
2019-08-30 04:02:20 +12:00
est31
7df48110ab Remove unused functions that use specialization 2019-08-29 16:14:43 +02:00
est31
c87fa14fc8 Replace crate visibility identifier with pub(crate)
Result of running:

find src -name *.rs -exec sed -i 's/crate /pub(crate) /g' {} \;
2019-08-29 13:09:09 +02:00
Jonathan Turner
e0a13de943 Remove bind_by_move nightly feature 2019-08-29 14:44:08 +12:00
Jonathan Turner
3750a04cfc
Merge branch 'master' into expand-tilde 2019-08-27 16:23:56 +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
Patrick Meredith
87a99bbabf Implement to-bson 2019-08-26 20:07:59 -04:00
Dirkjan Ochtman
b77effa434 Fix formatting with cargo fmt 2019-08-26 20:19:05 +02:00
Jonathan Turner
bc91c7f8b1
Merge pull request #355 from Porges/align-bytes
Improve formatting of numeric values (float, int, bytes)
2019-08-26 17:58:48 +12:00
est31
8af4713237 Replace type_name intrinsic by stable type_name 2019-08-24 17:52:36 +02:00
George Pollard
c67d4a6eff
Rework implementation method 2019-08-24 17:31:50 +12:00
George Pollard
12cedddd68
Align bytes values in tables 2019-08-24 15:26:08 +12:00
Jonathan Turner
136b5693cd Fix adding at shallow depth 2019-08-20 15:36:52 +12:00
Jonathan Turner
ebf7250383
Merge pull request #299 from nushell/improve-question-mark
Reduce unwraps
2019-08-17 16:08:59 +12:00
Yehuda Katz
5bfb96447a Reduce unwraps
Remove a number of unwraps. In some cases, a `?` just worked as is. I also made it possible to use `?` to go from Result<OutputStream, ShellError> to OutputStream. Finally, started updating PerItemCommand to be able to use the signature deserialization logic, which substantially reduces unwraps.

This is still in-progress work, but tests pass and it should be clear to merge and keep iterating on master.
2019-08-16 20:53:39 -07:00
Jonathan Turner
ec7d159c83 Switch to constraint solving the table 2019-08-17 08:03:29 +12:00
Yehuda Katz
0dc4b2b686 Add support for external escape valve (^dir)
This commit makes it possible to force nu to treat a command as an external command by prefixing it with `^`. For example `^dir` will force `dir` to run an external command, even if `dir` is also a registered nu command.

This ensures that users don't need to leave nu just because we happened to use a command they need.

This commit adds a new token type for external commands, which, among other things, makes it pretty straight forward to syntax highlight external commands uniquely, and generally to treat them as special.
2019-08-15 15:18:18 -07:00
Jonathan Turner
e19c618ac5
Revert "Rewrite the ps command" 2019-08-11 13:41:21 +12:00
Jonathan Turner
7c2fec5851 Rewrite the ps command 2019-08-11 11:09:40 +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
Yehuda Katz
14a52bc282 WIP - more streamlining 2019-08-06 09:26:33 -07: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
fc173c46d8 Restructuring 2019-08-02 12:15:07 -07:00
Jonathan Turner
6b7d9c1de0 Add glob to ls 2019-08-02 15:10:06 +12:00
Jonathan Turner
db3ff52973 Add tags command and fix source_map transfer 2019-08-01 15:25:59 +12:00
Jonathan Turner
462f783fac initial change to Tagged<Value> 2019-08-01 13:58:42 +12:00
Jonathan Turner
389d9988f3 Change list/object to better short names 2019-07-30 13:54:33 +12:00
Jonathan Turner
2464a33660 Progress the sys plugin a bit further 2019-07-28 08:09:25 +12:00
Jonathan Turner
a09361698e Update plugin protocol for begin, and create new sys plugin 2019-07-27 19:45:00 +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
Jonathan Turner
ec7d49b0d2 Add and edit functionality 2019-07-22 15:52:57 +12:00
Jonathan Turner
3b682046b7 new inc takes a path 2019-07-18 13:32:19 +12:00
Jonathan Turner
2ed46046bd Cleanup for upcoming release 2019-07-17 07:10:25 +12:00
Jonathan Turner
3ebb6ba991 Fix plugin's commandconfig 2019-07-16 19:08:35 +12:00
Jonathan Turner
60f4436849
Merge pull request #181 from nushell/string-arg
Make signatures a little more general
2019-07-16 09:40:36 +12:00
Yehuda Katz
ded3462e82 Make signatures a little more general 2019-07-15 14:16:27 -07:00
Jonathan Turner
ae4d3ab4cf Bump deps and add serde_bytes support 2019-07-16 06:34:44 +12:00
Jonathan Turner
720cc03649 Change 'file name' => 'name'. Same for type 2019-07-14 16:59:36 +12:00
Yehuda Katz
6bf55c0f1e Remove more dead code and clean up JSON 2019-07-12 19:20:26 -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