Commit Graph

334 Commits

Author SHA1 Message Date
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
Dirkjan Ochtman
8523ce3d01 Get rid of feature(crate_visibility_modifier) (see #362) 2019-09-01 21:56:17 +02:00
Jonathan Turner
1a67ac6102 Random fixes 2019-09-01 09:19:59 +12:00
Jonathan Turner
70ebe899c6
Merge pull request #552 from est31/image_decoding
Remove unused image features
2019-09-01 06:24:42 +12:00
est31
00c5adda80 Remove unused image features 2019-08-31 19:45:09 +02:00
est31
5b7940b88c Update bson to 0.14 2019-08-31 18:47:14 +02:00
Jonathan Turner
0d6b85b5bf
Merge branch 'master' into post 2019-08-31 16:39:24 +12: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
Jonathan Turner
1d77595576 Merge branch 'master' into post 2019-08-31 15:12:03 +12:00
Patrick Meredith
3d147d1143 Add SQLite support 2019-08-30 20:54:45 -04:00
Jonathan Turner
60bfa277d0 Experiment with async/await-enabled ps 2019-08-31 07:07:07 +12:00
Jonathan Turner
9e167713b3 Add post command 2019-08-31 06:27:15 +12:00
Jonathan Turner
39e06bbc80
Merge pull request #511 from svartalf/heim-0.0.7
Heim 0.0.7 preparations
2019-08-31 03:47:50 +12:00
svartalf
213db54378 Update to heim v0.0.7. 2019-08-30 18:08:57 +03:00
Guillaume Gomez
d1f70aff73 Update sysinfo version 2019-08-30 13:25:00 +02:00
Taiki Endo
ffdde542c7 Update futures-preview to 0.3.0-alpha.18 2019-08-29 22:42:49 +09:00
est31
7ca95ba9dd Remove unused prettyprint dependency 2019-08-29 01:38:39 +02: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
a75c90cc42 Rebase on master 2019-08-25 10:16:22 -04:00
Jonathan Turner
721a7b159d switch from reqwest to surf 2019-08-25 07:36:19 +12:00
Jonathan Turner
ea86d14673
Merge pull request #366 from aidanharris/update-openssl-sys
Update openssl-sys to v0.9.49 for libressl-3.0.0
2019-08-25 03:58:26 +12:00
est31
bd2be874c1 Remove unused unicode-width dependency 2019-08-24 15:57:44 +02:00
est31
651589164a Remove unused strip-ansi-escapes dependency 2019-08-24 15:55:18 +02:00
est31
f893ef03d6 Remove unused derive_more dependency 2019-08-24 15:52:27 +02:00
est31
ba602c4629 Remove unused lazy_static dependency 2019-08-24 15:51:54 +02:00
est31
4fb298aae0 Remove unused adhoc_derive dependency 2019-08-24 15:50:16 +02:00
est31
c811cbe821 Remove unused enum_derive dependency 2019-08-24 15:48:17 +02:00
est31
62e705079e Remove unused logos and logos_derive dependencies 2019-08-24 15:46:53 +02:00
est31
6e135cbc74 Remove unused async_trait dependency 2019-08-24 15:44:13 +02:00
est31
f6cf6f6768 Remove unused chrono-tz dependency 2019-08-24 15:42:28 +02:00
est31
aa9685e9a3 Also remove toml-query as it's not used 2019-08-24 09:58:25 +02:00
est31
9593007fea Remove unused tempdir dependency 2019-08-24 09:49:36 +02:00
Aidan Harris
e32ac882de
Update openssl-sys to v0.9.49 for libressl-3.0.0 2019-08-24 08:21:12 +01:00
Tom Forbes
9e2fc1c06d
Disable default git2 features 2019-08-23 23:59:05 +01: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
e3e4e30fb3 Lots of fixes ahead of release 2019-08-21 18:39:57 +12:00
Jonathan Turner
eb6e24c220 Wrap table cells as needed 2019-08-16 17:47:47 +12:00
Jonathan Turner
785536983a
Revert "Heuristic table view" 2019-08-16 04:49:07 +12:00
Jonathan Turner
123b1856c8 Attempt heuristic table 2019-08-13 19:45:31 +12:00
Jonathan Turner
6cf3dc92fc Add support for utf16 files 2019-08-12 16:11:42 +12:00
Jonathan Turner
8e652850dc add some battery stats 2019-08-11 15:01:09 +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
894958d5e8 Improve sys a bit 2019-08-11 10:13:03 +12:00
Jonathan Turner
1662824a5c Revert bump 2019-08-10 18:31:31 +12:00
Jonathan Turner
60e7dfcf1b Add back command completions 2019-08-10 17:02:15 +12:00
Jonathan Turner
aadacc2d36 Merge master 2019-08-09 16:51:21 +12:00
Jonathan Turner
bcd9d2d1a6 Pin semver breaking dep 2019-08-09 05:33:19 +12:00
Jonathan Turner
c231dd32cd
Multi shells (#254)
Add multi-shells
2019-08-08 05:49:11 +12:00
Yehuda Katz
fc173c46d8 Restructuring 2019-08-02 12:15:07 -07:00
Jonathan Turner
c42369f1f6 Move off of git deps 2019-08-02 15:58:10 +12:00
Andrés N. Robalino
375f311331 Wildcard support adventure starting with rm command. 2019-08-01 16:01:53 -05:00
Jonathan Turner
509dfe72a8 Switch to rustyline nightly 2019-07-31 05:57:22 +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
Jonathan Turner
5a4805d422 Switch way of doing terminal size calculation 2019-07-29 05:34:04 +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
1f26101e2f Yet more improvements to textview (and binaryview) 2019-07-26 04:22:22 +12:00
Jonathan Turner
568931c80c add basic paging to text views 2019-07-24 19:44:12 +12:00
Yehuda Katz
73deeb69db Clean up lint errors 2019-07-23 21:10:48 -07:00
Jonathan Turner
1e6a9b9b34 Merge branch 'master' into source_spans 2019-07-20 13:14:05 +12:00
Jonathan Turner
27dbc1cb9a Add syntect (and borrow bat's theme file) 2019-07-20 13:12:04 +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
227fdddc12 Add yaml roundtrip test. Bump nu version 2019-07-18 05:51:53 +12:00
Jonathan Turner
048b378e56 Remove failing tests and bump nom5_locate 2019-07-17 07:36:25 +12:00
Jonathan Turner
2ed46046bd Cleanup for upcoming release 2019-07-17 07:10:25 +12:00
Jonathan Turner
ae4d3ab4cf Bump deps and add serde_bytes support 2019-07-16 06:34:44 +12:00
Jonathan Turner
7e555a0ef2 "Add plugin arg errors. Bring remaining errors to parity" 2019-07-14 04:59:59 +12:00
Jonathan Turner
958bb534b4 Finish moving a couple commands to plugins, remove unused plugin 2019-07-06 05:19:19 +12:00
Jonathan Turner
ea997289d9 Add some logic for more binary formats 2019-07-05 19:53:09 +12:00
Jonathan Turner
563fabfdca Small cleanup, hopefull unbroken lock file 2019-07-05 13:01:19 +12:00
Jonathan Turner
73d87e57ab Switch to rawkey reader. Add more binary reading 2019-07-05 10:17:18 +12:00
Jonathan Turner
5e779d8b2b Add pretty binary viewing 2019-07-04 17:23:05 +12:00
Jonathan Turner
c653751d2c Bump and cleanup plugin name match 2019-07-04 15:06:43 +12:00
Jonathan Turner
0180769971 WIP now load plugins automatically 2019-07-04 05:37:09 +12:00
Jonathan Turner
c3697c67ca Make serialization full-fidelity 2019-06-30 18:46:49 +12:00
Jonathan Turner
d5704808d4 First working plugin 2019-06-27 16:56:48 +12:00
Jonathan Turner
6315e5c692 Remove unused deps 2019-06-27 06:24:42 +12:00
Jonathan Turner
c819126d00 Bump deps 2019-06-27 06:08:41 +12:00
Jonathan Turner
cfcf43ca93 Add content-type to open, refactor open/enter 2019-06-26 19:40:43 +12:00
Jonathan Turner
af82f44e13 Merge master, fix conflicts 2019-06-24 05:54:02 +12:00
Jonathan Turner
3d893d5afc Update sysinfo for better subsystem selection 2019-06-24 05:21:09 +12:00
Yehuda Katz
6af4dafd87 Update lockfile 2019-06-22 18:31:05 -04:00
Jonathan Turner
0046305ea1 Fix conflicts 2019-06-23 04:31:51 +12:00
Jonathan Turner
9ae9beb94a WIP 2019-06-22 15:43:37 +12:00
Jonathan Turner
baeb192f12 Merge master 2019-06-22 13:38:17 +12:00
Yehuda Katz
e981129f1f Things work 2019-06-21 21:36:57 -04:00
Jonathan Turner
3f718a20be Add a system info source 2019-06-19 16:53:55 +12:00
Jonathan Turner
a764a64161 Move back onto main subprocess 2019-06-18 14:04:34 +12:00
Jonathan Turner
1000ec21b5 Add .ini loading/saving 2019-06-16 18:43:40 +12:00
Yehuda Katz
4f3a5f0300 Paths 2019-06-14 20:16:13 -07:00
Yehuda Katz
c5c14e2d89 Add a bunch more tokens and delimited () 2019-06-14 20:16:13 -07:00
Yehuda Katz
4291e31dc7 Start rebuilding lite parser using nom 2019-06-14 20:16:13 -07:00
Jonathan Turner
22f9126cf6 merge master and fix conflict 2019-06-11 18:27:19 +12:00
Jonathan Turner
7642541755 Add xml open support 2019-06-11 18:26:03 +12:00
Yehuda Katz
2b876da56f Some function stuff
It's not done, but honestly it's getting too tedious. I will need to
rethink how I'm doing it.
2019-06-10 13:11:55 -07:00
Jonathan Turner
183a0138bf Temporarily switch to fixed branch 2019-06-10 19:32:30 +12:00
Jonathan Turner
62fac11e07 Cleanup and bump rustyline 2019-06-10 05:52:56 +12:00
Jonathan Turner
4e6c3d255c Add opening urls 2019-06-09 06:09:17 +12:00
Jonathan Turner
7d53592174 Add clipboard support 2019-06-08 04:30:50 +12:00
Jonathan Turner
7c794dc189 Add tree sink 2019-06-07 19:50:26 +12:00
Odin Dutton
b79dc2257c Handle Ctrl-C gracefully 2019-06-07 10:31:22 +10:00
Jonathan Turner
c050ce852b Lots of misc improvements 2019-06-03 19:41:28 +12:00
Jonathan Turner
9ba42eae46 Fix up tests 2019-06-03 12:03:40 +12:00
Jonathan Turner
2997d24f16
Merge branch 'master' into testing 2019-06-03 05:51:11 +12:00
Yehuda Katz
b9159f033b Parsing tests 2019-06-02 09:28:40 -07:00
Jonathan Turner
d6cd0df232 Add git branch to prompt 2019-06-02 09:11:28 +12:00
Yehuda Katz
5d4097073b Add --loglevel and --develop
--loglevel sets the log level for all of nu
--develop takes a list of modules and turns on trace mode for them
2019-06-01 10:00:42 -07:00
Yehuda Katz
69effbc9e7 Improve signature infrastructure
The `config` command uses different kinds of named arguments, which
illustrates how it works.
2019-05-31 22:54:15 -07:00
Yehuda Katz
b7d15c2afd Better errors and more fleshed out semantics 2019-05-29 21:19:46 -07:00
Yehuda Katz
e4013a008c Custom lexer 2019-05-29 08:26:45 -07:00
Yehuda Katz
d5255f6dbf
Evaluator MVP (#39)
Evaluator, MVP
2019-05-27 23:45:18 -07:00
Jonathan Turner
b34676441b Add json support 2019-05-28 14:01:37 +12:00
Yehuda Katz
b74daa2e60 A real parser (lalrpop) 2019-05-26 00:17:35 -07:00
Jonathan Turner
e73f489aeb Make our own LinesCodec 2019-05-25 12:07:52 -07:00
Yehuda Katz
9f8d2a4de5 Pipe external to internal
Each line is a string object
2019-05-24 11:48:33 -07:00
Yehuda Katz
bf332ea50c Improved streams 2019-05-23 21:34:43 -07:00
Yehuda Katz
31dd579d6f Small restructuring 2019-05-22 21:30:43 -07:00
Yehuda Katz
261d7a793f Restructure and make commands uniform 2019-05-22 00:12:03 -07:00
Yehuda Katz
89712bf1eb Fix manifest 2019-05-17 20:17:29 -07:00
Yehuda Katz
67d18df214 Bump version 2019-05-17 20:16:06 -07:00
Yehuda Katz
c30fc32b0c Bat 2019-05-17 18:24:13 -07:00
Yehuda Katz
2feef6bd25 Added a first pass at sort-by 2019-05-17 08:55:50 -07:00
Yehuda Katz
11677735f1 Fix Linux/Windows build on nightly 2019-05-16 23:37:35 -07:00
Yehuda Katz
90f4ba15cf Update name 2019-05-16 16:39:58 -07:00
Jonathan Turner
b342069fd5 Workaround color prompt by making our own helper 2019-05-16 06:06:46 -07:00
Yehuda Katz
638093aad6 Rename to nushell 2019-05-15 17:55:32 -07:00
Yehuda Katz
8f327477e7 Internals cleanup and | select ...fields 2019-05-15 13:14:51 -05:00
Yehuda Katz
ceb0487eba A bunch of rework
I'm gonna use a VecDeque now instead of trying to get async streams
working to make progress, but the intent is that we should be able to
use async streams in and out to interleave the work better.
2019-05-13 13:30:51 -04:00
Yehuda Katz
51e921b085 A bit more infra 2019-05-11 00:00:33 -07:00
Yehuda Katz
e44d657424 Simple parsing 2019-05-10 21:45:57 -07:00
Yehuda Katz
8f3b273337 objectshell initial commit 2019-05-10 09:59:12 -07:00