Commit Graph

107 Commits

Author SHA1 Message Date
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
Yehuda Katz
138b5af82b Basic support for decimal numbers
This commit is more substantial than it looks: there was basically no
real support for decimals before, and that impacted values all the way
through.

I also made Size contain a decimal instead of an integer (`1.6kb` is a
reasonable thing to type), which impacted a bunch of code.

The biggest impact of this commit is that it creates many more possible
ways for valid nu types to fail to serialize as toml, json, etc. which
typically can't support the full range of Decimal (or Bigint, which I
also think we should support). This commit makes to-toml fallible, and a
similar effort is necessary for the rest of the serializations.

We also need to figure out how to clearly communicate to users what has
happened, but failing to serialize to toml seems clearly superior to me
than weird errors in basic math operations.
2019-08-30 21:05:32 -07:00
svartalf
213db54378 Update to heim v0.0.7. 2019-08-30 18:08:57 +03:00
Jonathan Turner
8db21ddf99 Add tab support to textview 2019-08-30 15:47:30 +12:00
Jonathan Turner
4ebab3474b Fix the sys command 2019-08-28 04:26:14 +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
Dirkjan Ochtman
ce0113eb19 Replace use of unstable Option::flatten() with and_then() 2019-08-26 21:26:10 +02:00
Jonathan Turner
439700b87c Fix a few issues with textview and the parser 2019-08-25 19:15:56 +12:00
Jonathan Turner
721a7b159d switch from reqwest to surf 2019-08-25 07:36:19 +12:00
est31
8bdc715e3e Remove async_await feature gates 2019-08-24 09:09:26 +02:00
Jonathan Turner
bc6dc030c2 Fix bug in textview with rawkey 2019-08-24 06:51:03 +12:00
Jonathan Turner
6354e0cc55 Remove X11 requirement 2019-08-23 15:29:08 +12:00
Jonathan Turner
af51a65528 Try to fix warning 2019-08-22 17:40:33 +12:00
Jonathan Turner
422a0f8496 Disable rawkey on non-x11 linux 2019-08-22 17:11:13 +12:00
Jonathan Turner
e3e4e30fb3 Lots of fixes ahead of release 2019-08-21 18:39:57 +12:00
Jonathan Turner
136b5693cd Fix adding at shallow depth 2019-08-20 15:36:52 +12:00
Andrés N. Robalino
5dd20850b5 Refactoring and unwrap cleanup beginnings. 2019-08-18 20:28:55 -05:00
Jonathan Turner
dd18122a24 WIP 2019-08-15 17:02:02 +12:00
Jonathan Turner
7c4a4ec62e
Merge pull request #278 from androbtech/replace-and-find
Str plugin: replace & find-replace.
2019-08-12 06:46:49 +12:00
Andrés N. Robalino
cee2f5207e Str plugin: replace & find-replace. 2019-08-11 12:46:14 -05:00
Jonathan Turner
a6933ebe49
Add space for pagedown 2019-08-12 05:29:25 +12:00
Jonathan Turner
aea8bbf945 Clean up ghz view 2019-08-11 15:33:26 +12:00
Jonathan Turner
8e652850dc add some battery stats 2019-08-11 15:01:09 +12:00
Jonathan Turner
72aa433802
Merge pull request #268 from androbtech/additive-nushellacturing
Additive nushellacturing.
2019-08-11 14:03:15 +12: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
1cc661b916 Remove comments 2019-08-11 10:13:58 +12:00
Jonathan Turner
894958d5e8 Improve sys a bit 2019-08-11 10:13:03 +12:00
Andrés N. Robalino
e744237451 Clean up. 2019-08-10 05:56:47 -05:00
Andrés N. Robalino
5372463b37 Extract tests. 2019-08-10 04:40:32 -05:00
Andrés N. Robalino
cb4b2e6116 Inc refactoring. More tests. 2019-08-10 04:38:28 -05: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
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
Andrés N. Robalino
c5568b426c Communicate better. update -> permit. Thanks @jonathandturner 2019-08-01 19:19:31 -05:00
Andrés N. Robalino
0231e64e37 Spanned as Tagged. 2019-08-01 01:02:20 -05:00
Andrés N. Robalino
c195c1d21d Revert back test deleted by accident. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
174abf68bc Refactored. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
d105d77928 Actual (results) on left hand side and expected values on the right.
"toint" makes it more clear than "int" under Str(strutils) plugin.
2019-07-31 23:50:03 -05:00
Andrés N. Robalino
e7fb58ef9a Tests communicate better (separate) plugin wiring vs str features. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
832c329363 Check plugin str flags are wired properly when configuring. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
81d796472a Improved code readability. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
193b8dbe20 Syntax cleaning bit. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
8ac36e0e83 str from std not needed. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
a0890b551a strutils can also convert to an integer now. 2019-07-31 23:50:03 -05:00
Andrés N. Robalino
b29e7c1e36 cover raw strutils to upcase and downcase 2019-07-31 23:46:59 -05:00
Andrés N. Robalino
c3034d3247 No longer need to trace call_info 2019-07-31 23:46:59 -05:00