Commit Graph

249 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
Jonathan Turner
1a67ac6102 Random fixes 2019-09-01 09:19:59 +12:00
Jonathan Turner
1d77595576 Merge branch 'master' into post 2019-08-31 15:12:03 +12:00
Jonathan Turner
2cec8168c7 Merge master 2019-08-31 13:30:41 +12:00
Patrick Meredith
3d147d1143 Add SQLite support 2019-08-30 20:54:45 -04:00
Jonathan Turner
fa2c6ec227 Merge master 2019-08-31 10:13:09 +12:00
Jonathan Turner
9e167713b3 Add post command 2019-08-31 06:27:15 +12:00
Jonathan Turner
729051fdd2
Merge pull request #407 from iamcodemaker/vi
WIP: add support for vi mode
2019-08-30 15:54:30 +12:00
Taiki Endo
58a32490c5 Remove usage of in_band_lifetimes feature 2019-08-30 01:32:31 +09: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
Andrés N. Robalino
f1e8c433c2 [from/to]tsv support. 2019-08-29 04:02:16 -05:00
Jonathan Turner
f730296e45 WIP supporting from/to automatically 2019-08-29 15:53:45 +12:00
Jonathan Turner
4576570275
Merge pull request #520 from est31/remove_try_trait
Remove try_trait feature use
2019-08-29 14:46:53 +12:00
est31
012d8f3d6f Remove try_trait feature use 2019-08-29 03:12:10 +02:00
Yehuda Katz
21ad06b1e1 Remove unwraps and clean up playground
The original intent of this patch was to remove more unwraps to reduce
panics. I then lost a ton of time to the fact that the playground isn't
in a temp directory (because of permissions issues on Windows).

This commit improves the test facilities to:

- use a tempdir for the playground
- change the playground API so you instantiate it with a block that
  encloses the lifetime of the tempdir
- the block is called with a `dirs` argument that has `dirs.test()` and
  other important directories that we were computing by hand all the time
- the block is also called with a `playground` argument that you can use
  to construct files (it's the same `Playground` as before)
- change the nu! and nu_error! macros to produce output instead of
  taking a variable binding
- change the nu! and nu_error! macros to do the cwd() transformation
  internally
- change the nu! and nu_error! macros to take varargs at the end that
  get interpolated into the running command

I didn't manage to finish porting all of the tests, so a bunch of tests
are currently commented out. That will need to change before we land
this patch.
2019-08-28 10:01:16 -07: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
Jonathan Turner
5313fc5568
Merge pull request #477 from jonathandturner/fix_dbg_release
Fix having to clean directories when switching between release and debug
2019-08-27 14:11:30 +12:00
Jonathan Turner
716517c13f Fix having to clean directories when switching between release and debug 2019-08-27 13:46:38 +12:00
Patrick Meredith
87a99bbabf Implement to-bson 2019-08-26 20:07:59 -04:00
Andrés N. Robalino
3e699db57c Aviso. 2019-08-26 17:41:57 -05:00
Andrés N. Robalino
91093f2ab2 Avoid panicking if history can't be saved. 2019-08-26 17:18:38 -05:00
Kyle Strand
9a31a6c296 Permit use of Windows Batch files 2019-08-26 11:17:47 -06:00
Jonathan Turner
dda4a707a7
Merge pull request #421 from ramonsnir/reverse
add reverse
2019-08-26 05:41:07 +12:00
Ramon Snir
9735c3fcea
add reverse 2019-08-25 12:14:17 -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
Matthew Nicholson
6ebf6f8a8f set rustyline's edit_mode based on a config option
This adds support for vi mode.
2019-08-25 01:12:23 -04:00
Issac Trotts
108f66941b add last command 2019-08-24 15:01:30 -07: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
Odin Dutton
d71206ed9e Implement WholeStreamCommand for all remaining commands 2019-08-19 15:16:39 +10:00
Odin Dutton
4de6c941e1 Introduce version command 2019-08-19 11:30:29 +10: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
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
dd18122a24 WIP 2019-08-15 17:02:02 +12:00
Andrés N. Robalino
154063013f mv introduced. \¡Viva\! 2019-08-14 15:29:05 -05:00
Jonathan Turner
99b881e42f Add first per-item commands 2019-08-15 05:02:39 +12:00
Jonathan Turner
4411a5b72c
Merge pull request #281 from jonathandturner/improve_arrays
Add from_array and improve array viewing
2019-08-12 18:16:08 +12:00
Jonathan Turner
3d5395fdd5 Add from_array and improve array viewing 2019-08-12 17:51:13 +12:00
Jonathan Turner
14e47f3d2c Add nth command 2019-08-12 17:13:58 +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
c97578bf6e Add which command 2019-08-10 19:06:08 +12:00
Jonathan Turner
eeed31837f cleanup 2019-08-10 08:49:43 +12:00
Jonathan Turner
34759b7646 Add back in cd/ls and completions 2019-08-10 07:42:23 +12:00
Jonathan Turner
cabd5bf009 Fix sink plugins 2019-08-09 19:54:21 +12:00
Jonathan Turner
aadacc2d36 Merge master 2019-08-09 16:51:21 +12:00
Jonathan Turner
80bcc51294 get tests passing by fixing classifying external 2019-08-08 17:09:38 +12:00
Andrés N. Robalino
c8b5329c5c mkdir. 2019-08-07 13:24:20 -05:00
Jonathan Turner
c231dd32cd
Multi shells (#254)
Add multi-shells
2019-08-08 05:49:11 +12:00
Yehuda Katz
14a52bc282 WIP - more streamlining 2019-08-06 09:26:33 -07: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
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
c85b7728bc Remove old sysinfo and finish sys 2019-07-28 14:02:42 +12:00
Jonathan Turner
96f26b30a7 Add date command 2019-07-26 16:09:19 +12:00
Yehuda Katz
5a8e041a48 Tests pass! 2019-07-23 15:22:11 -07:00
Andrés N. Robalino
2da43f4b06 Introduced initial cp functionality. 2019-07-21 21:23:02 -05:00
Andrés N. Robalino
191dacdd8b Introduced conversion to csv command. 2019-07-21 02:08:05 -05: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
Andrés N. Robalino
514da5bfa7 Can remove files and directories. 2019-07-18 05:21:24 -05: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
c94c663771 Fix up some of the save formats 2019-07-16 16:03:28 +12:00
Yehuda Katz
7c2a1c619e Tests pass 2019-07-12 19:20:26 -07:00
Yehuda Katz
70f9e355fd WIP 2019-07-12 19:20:26 -07:00
Yehuda Katz
7b68739b52 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
958bb534b4 Finish moving a couple commands to plugins, remove unused plugin 2019-07-06 05:19:19 +12:00
Jonathan Turner
73d87e57ab Switch to rawkey reader. Add more binary reading 2019-07-05 10:17:18 +12:00
Jonathan Turner
65a0d27c8a Add binary type and tree sink 2019-07-04 17:11:56 +12:00
Jonathan Turner
dc8545ce10 Add a test for the plugins 2019-07-04 15:18:19 +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
75ddfe9f5a Add filter and sink plugins 2019-07-02 19:56:20 +12:00
Jonathan Turner
c3697c67ca Make serialization full-fidelity 2019-06-30 18:46:49 +12:00
Jonathan Turner
47f23cacc7 Add second plugin 2019-06-28 04:47:24 +12:00
Jonathan Turner
d5704808d4 First working plugin 2019-06-27 16:56:48 +12:00
Jonathan Turner
c969c2c362 Clean up old parser code 2019-06-25 16:33:12 +12:00
Yehuda Katz
7957fc502f Fix a bunch of bugs 2019-06-23 18:55:31 -06:00
Yehuda Katz
cbab97174e Fix painting 2019-06-23 13:35:43 -04: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
Jonathan Turner
9ae9beb94a WIP 2019-06-22 15:43:37 +12:00
Yehuda Katz
e981129f1f Things work 2019-06-21 21:36:57 -04:00
Jonathan Turner
18e39343ad Add vertical table view 2019-06-21 16:20:06 +12:00
Jonathan Turner
3f718a20be Add a system info source 2019-06-19 16:53:55 +12:00
Jonathan Turner
54301fe3be Add lines and improve split 2019-06-18 12:39:09 +12:00
Jonathan Turner
1000ec21b5 Add .ini loading/saving 2019-06-16 18:43:40 +12:00
Jonathan Turner
eae83d85d2 Add more error checking 2019-06-16 11:03:49 +12:00
Jonathan Turner
416d1c8cbb Merge branch 'master' into touchups 2019-06-16 06:41:26 +12:00
Jonathan Turner
54be5bf16e Update errors and improve ctrl-c 2019-06-16 06:36:17 +12:00
Jonathan Turner
910869b79d Get stream errors working 2019-06-16 05:52:55 +12:00
Jonathan Turner
d7c49fa3be More touchups. Fix crash 2019-06-15 16:20:58 +12:00
Jonathan Turner
d94e0d436e Add exit 2019-06-14 10:49:16 +12:00
Jonathan Turner
f40089f29b Better cd and ls 2019-06-14 09:47:25 +12:00
Jonathan Turner
7642541755 Add xml open support 2019-06-11 18:26:03 +12:00
Jonathan Turner
62fac11e07 Cleanup and bump rustyline 2019-06-10 05:52:56 +12:00
Jonathan Turner
e94d1d2758 Add pretty errors to commands 2019-06-08 10:35:07 +12:00
Jonathan Turner
62b648ceb8 Add save sink 2019-06-08 05:13:38 +12:00
Jonathan Turner
2f590d051a Rename to clip 2019-06-08 04:46:47 +12:00
Jonathan Turner
7d53592174 Add clipboard support 2019-06-08 04:30:50 +12:00
Jonathan Turner
1cd1622019 Fix tests 2019-06-07 19:54:52 +12:00
Jonathan Turner
7c794dc189 Add tree sink 2019-06-07 19:50:26 +12:00
Jonathan Turner
090ec031a9 Add sinks 2019-06-07 18:34:42 +12:00
Odin Dutton
b79dc2257c Handle Ctrl-C gracefully 2019-06-07 10:31:22 +10:00
Jonathan Turner
f31c08e941
Merge pull request #87 from wycats/better-parser
Span all the things
2019-06-06 20:00:37 +12:00
Yehuda Katz
324f7915be Span all the things
Also set up builder infra for more consistent AST creation.
2019-06-05 23:34:59 -07:00
Jonathan Turner
05dc715876 Rename select to get 2019-06-05 13:53:38 +12:00
Yehuda Katz
f3bb4a03c2 Improve parser 2019-06-04 14:42:31 -07:00
Jonathan Turner
c050ce852b Lots of misc improvements 2019-06-03 19:41:28 +12:00
Yehuda Katz
a8574abbf2 Improve errors 2019-06-02 22:11:21 -07:00
Jonathan Turner
2a20192519 Fix up some warnings and move integration tests to correct dir 2019-06-03 15:48:58 +12:00
Jonathan Turner
9ba42eae46 Fix up tests 2019-06-03 12:03:40 +12:00
Jonathan Turner
90d0182a54 Rename to first and pick 2019-06-03 06:53:30 +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
Jonathan Turner
e3e1d81f48 Add to_toml export 2019-06-02 06:26:04 +12:00
Jonathan Turner
5d901a11e1
Add from_toml (#54) 2019-06-01 19:05:57 +12: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
Jonathan Turner
d7ff9fb7b7
Trim (#52)
Add a simple trim command
2019-06-01 15:43:59 +12:00
Jonathan Turner
5043367d11
Internal to external (#51)
Add a simple form of internal->external support
2019-06-01 15:19:03 +12:00
Jonathan Turner
1012a8dc41 Cleanup/rename some commands 2019-06-01 08:34:15 +12:00
Jonathan Turner
9bf279508e Merge branch 'master' of https://github.com/wycats/nushell 2019-05-31 04:12:47 +12:00
Yehuda Katz
c523ae0f48 More fixes for external args 2019-05-29 22:33:47 -07:00
Jonathan Turner
7066b6ecca Merge with master 2019-05-30 17:09:23 +12:00
Jonathan Turner
dd35b2460c Add row-split 2019-05-30 17:08:42 +12:00
Yehuda Katz
b7d15c2afd Better errors and more fleshed out semantics 2019-05-29 21:19:46 -07:00
Jonathan Turner
8e00cd43a8 Add select command which opens cell 2019-05-29 16:02:36 +12:00
Yehuda Katz
d5255f6dbf
Evaluator MVP (#39)
Evaluator, MVP
2019-05-27 23:45:18 -07:00
Jonathan Turner
10702cd27f Add size units to parsing 2019-05-28 17:05:14 +12:00
Jonathan Turner
d35a9d17ad
Merge branch 'master' into size 2019-05-28 14:06:35 +12:00
Jonathan Turner
b34676441b Add json support 2019-05-28 14:01:37 +12:00
Yehuda Katz
8464bcbb70
Merge branch 'master' into size 2019-05-26 00:20:01 -07:00
Yehuda Katz
b74daa2e60 A real parser (lalrpop) 2019-05-26 00:17:35 -07:00
Odin Dutton
a2b63f7e0c Add size command 2019-05-26 12:12:47 +10:00
Jonathan Turner
ad0b79673e Add split command 2019-05-24 18:20:03 -07:00
Yehuda Katz
bd055f2af1 Linting and other cleanup 2019-05-24 12:35:22 -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
f9fb353c5c Streams are wired up pairwise 2019-05-24 00:29:16 -07:00
Yehuda Katz
bf332ea50c Improved streams 2019-05-23 21:34:43 -07:00
Yehuda Katz
625a356361 Data flows across commands via streams now 2019-05-23 00:23:06 -07:00
Yehuda Katz
31dd579d6f Small restructuring 2019-05-22 21:30:43 -07:00