Commit Graph

556 Commits

Author SHA1 Message Date
Jonathan Turner
3827ded43f
Merge pull request #492 from jonathandturner/fix_sys
Fix the sys command
2019-08-28 04:49:27 +12:00
Jonathan Turner
6d30acf542
Merge pull request #455 from oskarskog/split-with-empty-cols
Preserve empty columns if separator isn't whitespace
2019-08-28 04:35:15 +12:00
Jonathan Turner
4ebab3474b Fix the sys command 2019-08-28 04:26:14 +12:00
Oskar Skog
9aab884db0 Merge branch 'master' into split-with-empty-cols 2019-08-27 14:47:48 +03:00
Andrés N. Robalino
f59b78a764
Merge pull request #486 from androbtech/fromto-checks
[from|to]json additions/refactoring.
2019-08-27 06:43:27 -05:00
Oskar Skog
14f6b49483 Add flag for collapsing empty columns 2019-08-27 14:30:09 +03:00
Andrés N. Robalino
b502954558 [from|to]json additions/refactoring. 2019-08-27 06:05:51 -05:00
Jonathan Turner
1cdfe358c2 Fix the utf-8 width calculation 2019-08-27 18:06:30 +12:00
Jonathan Turner
570a0ac275 Fix path-related parts of value shell 2019-08-27 17:15:05 +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
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
e32291d0d7
Merge pull request #473 from androbtech/history
Avoid panicking if history can't be saved.
2019-08-26 18:47:07 -05: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
Dirkjan Ochtman
ce0113eb19 Replace use of unstable Option::flatten() with and_then() 2019-08-26 21:26:10 +02:00
Dirkjan Ochtman
b77effa434 Fix formatting with cargo fmt 2019-08-26 20:19:05 +02:00
Kyle Strand
9a31a6c296 Permit use of Windows Batch files 2019-08-26 11:17:47 -06:00
Jonathan Turner
d51e12c69d
Merge pull request #453 from twe4ked/pull-version-from-clap
Return version from clap
2019-08-27 03:43:23 +12:00
Oskar Skog
8445cda291 Preserve empty columns if separator isn't whitespace
#394
2019-08-26 15:00:27 +03:00
Odin Dutton
bbe7d68659 Return version from clap
This is what `nu --version` uses.
2019-08-26 20:33:28 +10:00
Jonathan Turner
033cae2464 Fix the build 2019-08-26 18:42:14 +12: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
Jonathan Turner
8ff418dc00
Merge pull request #349 from Porges/box-drawing
Use Unicode box-drawing characters for tables
2019-08-26 17:57:48 +12:00
Andrés N. Robalino
12e3806349
Merge pull request #415 from androbtech/fromto-refact
[from|to]csv additions/refactoring.
2019-08-25 12:56:28 -05:00
Jonathan Turner
dda4a707a7
Merge pull request #421 from ramonsnir/reverse
add reverse
2019-08-26 05:41:07 +12:00
Andrés N. Robalino
0e14ba86ae [from|to]csv additions/refactoring.
Introduced flag to tell `from-to` / `to-csv` whether we want headers parsed and/or written.
2019-08-25 12:32:08 -05:00
Ramon Snir
9735c3fcea
add reverse 2019-08-25 12:14:17 -04:00
Patrick Meredith
a75c90cc42 Rebase on master 2019-08-25 10:16:22 -04:00
Patrick Meredith
c967f15e7c Fix tests 2019-08-25 09:50:25 -04:00
Patrick Meredith
b0d7daa0d6 Remove cargo culted latest_tag that is not needed for from_bson 2019-08-25 09:50:25 -04:00
Patrick Meredith
a3b4d47b4e Finish last few types and add tests 2019-08-25 09:50:25 -04:00
Patrick Meredith
722e192c14 Implement some more of the bson types 2019-08-25 09:50:25 -04:00
Patrick Meredith
9814eeae30 Remove need for impl Clone on from_bson_bytes_to_value 2019-08-25 09:50:25 -04:00
Patrick Meredith
a0f0372839 Add mostly working BSON support (missing some types) 2019-08-25 09:50:25 -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
George Pollard
cce5b5bb5e
Revert ellipsis changes 2019-08-25 20:00:04 +12:00
Jonathan Turner
439700b87c Fix a few issues with textview and the parser 2019-08-25 19:15:56 +12:00
Jonathan Turner
ac15989bbb
Merge branch 'master' into surf 2019-08-25 17:41:10 +12: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
Matthew Nicholson
f5afbe8984 write the config after removing a key 2019-08-25 00:51:12 -04:00
Jonathan Turner
9c4f94fed5
Merge pull request #402 from ijt/add-last-command
Add `last` filter
2019-08-25 13:00:13 +12:00
Issac Trotts
108f66941b add last command 2019-08-24 15:01:30 -07:00
Dmitry Starostin
19772f82aa
Add --reverse option for sort-by 2019-08-25 00:11:38 +03:00
Jonathan Turner
721a7b159d switch from reqwest to surf 2019-08-25 07:36:19 +12:00
Kyle Gretchev
b36bda24fa use clap::crate_version!()
- `crate_version()!` will pull version from Cargo.toml
2019-08-24 12:38:18 -04:00
est31
8af4713237 Replace type_name intrinsic by stable type_name 2019-08-24 17:52:36 +02:00
Jonathan Turner
a0d716054f
Merge pull request #367 from est31/remove_feature_gates
Remove some redundant/unused feature gates
2019-08-25 03:49:52 +12:00
Jonathan Turner
bb794dcfec Add expansion to from-* for lists 2019-08-24 19:38:38 +12:00
est31
6babefbb00 Remove some unused feature gates 2019-08-24 09:23:39 +02:00
est31
8bdc715e3e Remove async_await feature gates 2019-08-24 09:09:26 +02:00
George Pollard
877bbcd931
Remove unused import 2019-08-24 17:38:32 +12: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
George Pollard
9de0b27867
Use Unicode box-drawing characters for tables 2019-08-24 14:12:35 +12:00
Jonathan Turner
2663405115
Merge pull request #337 from jonathandturner/cleanup_column_error
Clean up error text
2019-08-24 08:58:03 +12:00
Jonathan Turner
0a611266ce Clean up error text 2019-08-24 08:31:14 +12:00
Jonathan Turner
bc6dc030c2 Fix bug in textview with rawkey 2019-08-24 06:51:03 +12:00
Jonathan Turner
35346d7710
Merge pull request #335 from androbtech/wraps
rmwrapped cd - ls.
2019-08-23 20:11:17 +12:00
Andrés N. Robalino
92ce31ac46 rmwrapped cd - ls 2019-08-22 23:51:43 -05:00
Jonathan Turner
6354e0cc55 Remove X11 requirement 2019-08-23 15:29:08 +12:00
Jonathan Turner
03c29b9a6f Remove an unwrap 2019-08-23 04:44:31 +12:00
Jonathan Turner
399b411a9c
Merge pull request #332 from jonathandturner/fix_abs_ls
Fix absolute ls
2019-08-22 20:18:21 +12:00
Jonathan Turner
effbc56ec8 Fix absolute ls 2019-08-22 19:52:57 +12:00
Jonathan Turner
c4a4e5ffab
Merge pull request #330 from jonathandturner/disable_nonx11_rawkey
Disable rawkey on non-x11 linux
2019-08-22 18:17:19 +12:00
Jonathan Turner
af51a65528 Try to fix warning 2019-08-22 17:40:33 +12:00
Jonathan Turner
b9b462ffeb Remove dep import 2019-08-22 17:15:14 +12:00
Jonathan Turner
422a0f8496 Disable rawkey on non-x11 linux 2019-08-22 17:11:13 +12:00
Jonathan Turner
87930ba35a Fix tests 2019-08-22 16:23:57 +12:00
Jonathan Turner
303d27d4b6 Finish adding support for protecting value shells 2019-08-22 16:13:40 +12:00
Jonathan Turner
78ca297e47 WIP 2019-08-22 07:38:09 +12:00
Jonathan Turner
73e3402e2f Merge master 2019-08-22 05:09:23 +12:00
Jonathan Turner
e012e04da0 Disallow fileops on values 2019-08-22 05:03:59 +12:00
Jonathan Turner
3c7ca8c403
Merge pull request #327 from jonathandturner/cleanup_ps
Cleanup unneeded compiler flag
2019-08-22 04:57:25 +12:00
Andrés N. Robalino
c2b377eedc Leave Nu's shell manager to figure out the suitable path for us instead. 2019-08-21 11:23:26 -05:00
Jonathan Turner
8e5744cf9b Cleanup unneeded compiler flag 2019-08-22 04:00:29 +12:00
Andrés N. Robalino
1e8793135a Mark the unwrap and Sweep the unwrap a bit more. 2019-08-21 10:48:04 -05:00
Andrés N. Robalino
8d5fd6f379 Unwrap cleanup mitigation. 2019-08-21 10:08:38 -05:00
Andrés N. Robalino
8b79b28971 mkdir can take multiple directories or multiple directory hierachies and wil create them as required. 2019-08-21 07:07:37 -05:00
Jonathan Turner
23ef76a86b
Update ps.rs 2019-08-21 20:19:36 +12:00
Jonathan Turner
c98bf68341 Oops, one more time 2019-08-21 19:47:33 +12:00
Jonathan Turner
c54528651d Fix ps again 2019-08-21 19:41:18 +12:00
Jonathan Turner
1a74c512ad
Merge pull request #324 from jonathandturner/ps_deps_and_more
Lots of fixes ahead of release
2019-08-21 19:08:01 +12:00
Jonathan Turner
e3e4e30fb3 Lots of fixes ahead of release 2019-08-21 18:39:57 +12:00
Andrés N. Robalino
0f28719564 mv -> More organized method definitions. 2019-08-20 07:35:41 -05:00
Andrés N. Robalino
11095860c8 rm fully operational and error surveyd. 2019-08-20 06:22:11 -05:00
Jonathan Turner
64c129d65f Finish updating the last cases 2019-08-20 18:11:11 +12:00
Jonathan Turner
421aacee76 Merge branch 'master' into implement-whole-stream-command-for-all-commands 2019-08-20 16:13:49 +12:00
Jonathan Turner
136b5693cd Fix adding at shallow depth 2019-08-20 15:36:52 +12:00
Odin Dutton
31790a9906 Use args structs to better extract multiple arguments 2019-08-20 13:15:05 +10:00
Odin Dutton
9951691023 Use NthArgs to better convert to an integer
Using i64 as u64 deserialize isn't implemented yet.
2019-08-20 13:12:31 +10:00
Odin Dutton
82a315f06a Make cd argument optional
`cd` with no arugments changes directory to $HOME.
2019-08-20 13:11:29 +10:00
Odin Dutton
56c04ff5b6 Remove unneeded TODOs
These commands have been confirmed to have no arguments.
2019-08-20 13:11:01 +10:00
Jonathan Turner
953d28ef74 Fix push/pop for shell manager 2019-08-19 20:07:55 +12:00
Jonathan Turner
fef447a659 Fix shell-ring to rotate as expected 2019-08-19 19:29:27 +12:00
Odin Dutton
d71206ed9e Implement WholeStreamCommand for all remaining commands 2019-08-19 15:16:39 +10:00
Jonathan Turner
095f4645c0
Merge pull request #307 from androbtech/qwrapport
Refactoring and unwrap cleanup beginnings.
2019-08-19 14:06:43 +12:00
Jonathan Turner
7b2b671b1e
Merge pull request #309 from twe4ked/version-command
Introduce version command
2019-08-19 14:06:04 +12:00
Odin Dutton
4de6c941e1 Introduce version command 2019-08-19 11:30:29 +10:00
Andrés N. Robalino
5dd20850b5 Refactoring and unwrap cleanup beginnings. 2019-08-18 20:28:55 -05:00
Odin Dutton
b5db24f9ad Fix typo in date command signature 2019-08-19 10:55:28 +10: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
Jonathan Turner
8a66a000e4 Add more polish to table wrap 2019-08-17 04:32:35 +12:00
Jonathan Turner
ffd60bb3af Remove stray println 2019-08-16 17:56:23 +12:00
Jonathan Turner
eb6e24c220 Wrap table cells as needed 2019-08-16 17:47:47 +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
785536983a
Revert "Heuristic table view" 2019-08-16 04:49:07 +12:00
Jonathan Turner
efd9631a90 All tests pass 2019-08-15 17:46:19 +12:00
Jonathan Turner
dd18122a24 WIP 2019-08-15 17:02:02 +12:00
Andrés N. Robalino
cbf6eed2d7 Communicates unsupported feature the case where directories are found in globs whether we cp or mv 2019-08-14 17:00:11 -05:00
Andrés N. Robalino
154063013f mv introduced. \¡Viva\! 2019-08-14 15:29:05 -05:00
Andrés N. Robalino
bd71773b5b Extracted File traversal utility for use in other commands. 2019-08-14 15:29:05 -05:00
Andrés N. Robalino
278de0e517 cp refactoring. 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
156e72f694 Finish up heuristic for table printing 2019-08-14 04:33:59 +12:00
Jonathan Turner
123b1856c8 Attempt heuristic table 2019-08-13 19:45:31 +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
6cf3dc92fc Add support for utf16 files 2019-08-12 16:11:42 +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
Jonathan Turner
d07a3928b2 Fix test failure 2019-08-11 08:33:22 +12:00
Jonathan Turner
8f78995014 Improve enter and fix bugs 2019-08-11 08:18:14 +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
c97578bf6e Add which command 2019-08-10 19:06:08 +12:00
Jonathan Turner
60e7dfcf1b Add back command completions 2019-08-10 17:02:15 +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
83030094e0 All tests pass 2019-08-09 17:36:43 +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
Jonathan Turner
b173fa6303 Fix table print for ls 2019-08-08 16:57:38 +12:00
Jonathan Turner
e8ae46ddb5 Fix the canonicalize of set_path 2019-08-08 12:52:29 +12:00
Andrés N. Robalino
ba6d62ea0c mkdir creates intermediary directories as required (the default). --create-all/--deep flag removed. 2019-08-07 14:38:00 -05:00