Commit Graph

170 Commits

Author SHA1 Message Date
Andrés N. Robalino
b35549adac Removes regex crate dependency. 2019-09-11 22:20:42 -05:00
Maximilian Roos
127381497c
run rustfmt 2019-09-11 10:36:50 -04:00
Jonathan Turner
bee7c5639c
Revert "Migrate most uses of the Span concept to Tag" 2019-09-11 19:53:05 +12:00
Yehuda Katz
58b7800172 Migrate most uses of the Span concept to Tag
Also migrate mv, rm and commands like that to taking a
SyntaxType::Pattern instead of a SyntaxType::Path for their first
argument.
2019-09-10 20:41:03 -07:00
Andrés N. Robalino
ba8383ae2f to-[csv/tsv] fixes. 2019-09-10 07:00:25 -05:00
Jonathan Turner
448b1a4848 Make some plugins optional, move ps to plugin 2019-09-08 19:06:15 +12:00
Jonathan Turner
dcd97b6346 Move internal terminology to tables/rows 2019-09-06 04:23:42 +12:00
Jonathan Turner
0a9897c5ca Move us away from mixing OOP and spreadsheet to just spreadsheet 2019-09-05 04:29:49 +12:00
Jonathan Turner
3d912a2c1d
Merge pull request #575 from nushell/remove-unused-code
Remove unused code
2019-09-02 20:24:18 +12:00
Andrés N. Robalino
2cb290b77b
Merge pull request #573 from androbtech/embed
can embed a new field to the table.
2019-09-02 01:14:06 -05:00
Yehuda Katz
7fa09f59c2 Remove unused code
Closes #467
2019-09-01 23:11:05 -07:00
Andrés N. Robalino
9488c41dcd can embed a new field to the table 2019-09-02 00:37:13 -05:00
Yehuda Katz
8a29c9e6ab Migrated numerics to BigInt/BigDecimal
This commit migrates Value's numeric types to BigInt and BigDecimal. The
basic idea is that overflow errors aren't great in a shell environment,
and not really necessary.

The main immediate consequence is that new errors can occur when
serializing Nu values to other formats. You can see this in changes to
the various serialization formats (JSON, TOML, etc.). There's a new
`CoerceInto` trait that uses the `ToPrimitive` trait from `num_traits`
to attempt to coerce a `BigNum` or `BigDecimal` into a target type, and
produces a `RangeError` (kind of `ShellError`) if the coercion fails.

Another possible future consequence is that certain performance-critical
numeric operations might be too slow. If that happens, we can introduce
specialized numeric types to help improve the performance of those
situations, based on the real-world experience.
2019-09-01 21:00:30 -07: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
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
Andrés N. Robalino
0b8bbd8637 Unit Testing WIP. 2019-07-31 23:46:59 -05:00
Jonathan Turner
462f783fac initial change to Tagged<Value> 2019-08-01 13:58:42 +12:00
Jonathan Turner
509dfe72a8 Switch to rustyline nightly 2019-07-31 05:57:22 +12:00
Jonathan Turner
8ac70e7408 Various open improvements 2019-07-30 15:48:02 +12:00
Jonathan Turner
2e84276d68
Merge pull request #228 from jonathandturner/sys_unwrap_refactor
Fix unwraps in sys
2019-07-30 13:30:11 +12:00
Jonathan Turner
583ef0da32 Fix unwraps in sys 2019-07-30 13:14:01 +12:00
Jonathan Turner
a8cb395bf1
Merge pull request #227 from jonathandturner/bump
Bump deps
2019-07-29 20:17:01 +12:00
Jonathan Turner
618be5de54 Remove workaround. Need a better one 2019-07-29 20:01:09 +12:00
Jonathan Turner
bd639b52ff bump deps 2019-07-29 19:46:24 +12:00
Jonathan Turner
403f9d2499
Revert "Switch way of doing terminal size calculation" 2019-07-29 16:18:11 +12:00
Andrés N. Robalino
be4262e96a Separate Nu plugin logic. 2019-07-28 21:30:47 -05:00
Andrés N. Robalino
87b299739c Make the validation especific to str plugin for now. 2019-07-28 20:28:43 -05:00
Andrés N. Robalino
7c4706ee50 Validation baseline. 2019-07-28 18:34:37 -05:00
Jonathan Turner
5a4805d422 Switch way of doing terminal size calculation 2019-07-29 05:34:04 +12:00
Andrés N. Robalino
59dec999b8 string utils plugin baseline. 2019-07-28 02:01:32 -05:00
Jonathan Turner
c85b7728bc Remove old sysinfo and finish sys 2019-07-28 14:02:42 +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
Jonathan Turner
eba20e5c7b Partial buffers just get printed to screen 2019-07-27 07:31:46 +12:00
Jonathan Turner
e4797f8895 Add end_plugin and sum 2019-07-27 06:40:00 +12:00
Jonathan Turner
1f26101e2f Yet more improvements to textview (and binaryview) 2019-07-26 04:22:22 +12:00
Jonathan Turner
e74856a14e Redo frame 2019-07-25 17:19:19 +12:00
Jonathan Turner
f2873edf6c One more go at fixing scroll textarea in windows 2019-07-25 14:43:51 +12:00
Jonathan Turner
501482cc31 Move to rawkey 2019-07-25 13:25:17 +12:00
Jonathan Turner
a6b79748d9 Move to async keys for textview 2019-07-25 13:07:33 +12:00
Jonathan Turner
f3fdda8d35 Move textview to plugin 2019-07-25 05:14:30 +12:00
Jonathan Turner
568931c80c add basic paging to text views 2019-07-24 19:44:12 +12:00
Jonathan Turner
ec7d49b0d2 Add and edit functionality 2019-07-22 15:52:57 +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
e66c687da6 Add semver increment 2019-07-18 13:49:12 +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
c7abb31b7c Fix inc plugin 2019-07-16 19:25:48 +12:00
Jonathan Turner
3ebb6ba991 Fix plugin's commandconfig 2019-07-16 19:08:35 +12:00
Jonathan Turner
7ffab5441b Merge branch 'master' into pixel_ascii 2019-07-16 17:23:17 +12:00
Jonathan Turner
1ecb4401ba WIP 2019-07-16 15:25:36 +12:00
Yehuda Katz
ded3462e82 Make signatures a little more general 2019-07-15 14:16:27 -07:00