Commit Graph

49 Commits

Author SHA1 Message Date
Shaurya Shubham
4429a75e17 Make ls show only the file name (#1276)
* Make ls show only the file name

* Refactor and remove unwraps

* Put functionality in separate flag
2020-01-26 05:20:33 +13:00
Jason Gedge
47d987d37f Add ctrl_c to RunnablePerItemContext. (#1239)
Also, this commit makes `ls` a per-item command.

A command that processes things item by item may still take some time to stream
out the results from a single item. For example, `ls` on a directory with a lot
of files could be interrupted in the middle of showing all of these files.
2020-01-19 15:25:07 +13:00
Kevin DCR
21e508009f Refactor struct names for old commands (ls, cd, pwd) (#1133) 2019-12-29 10:33:31 +13:00
Yehuda Katz
e4226def16 Extract core stuff into own crates
This commit extracts five new crates:

- nu-source, which contains the core source-code handling logic in Nu,
  including Text, Span, and also the pretty.rs-based debug logic
- nu-parser, which is the parser and expander logic
- nu-protocol, which is the bulk of the types and basic conveniences
  used by plugins
- nu-errors, which contains ShellError, ParseError and error handling
  conveniences
- nu-textview, which is the textview plugin extracted into a crate

One of the major consequences of this refactor is that it's no longer
possible to `impl X for Spanned<Y>` outside of the `nu-source` crate, so
a lot of types became more concrete (Value became a concrete type
instead of Spanned<Value>, for example).

This also turned a number of inherent methods in the main nu crate into
plain functions (impl Value {} became a bunch of functions in the
`value` namespace in `crate::data::value`).
2019-12-02 10:54:12 -08:00
Yehuda Katz
f70c6d5d48 Extract nu_source into a crate
This commit extracts Tag, Span, Text, as well as source-related debug
facilities into a new crate called nu_source.

This change is much bigger than one might have expected because the
previous code relied heavily on implementing inherent methods on
`Tagged<T>` and `Spanned<T>`, which is no longer possible.

As a result, this change creates more concrete types instead of using
`Tagged<T>`. One notable example: Tagged<Value> became Value, and Value
became UntaggedValue.

This change clarifies the intent of the code in many places, but it does
make it a big change.
2019-11-25 07:37:33 -08:00
Jonathan Turner
2bb03d9813 Abbreviate ls by default, add --full flag 2019-11-18 06:10:50 +13:00
Jonathan Turner
fbd980f8b0 Add descriptions to arguments 2019-10-28 18:15:35 +13:00
Jonathan Turner
193b00764b
Stream support (#812)
* Moves off of draining between filters. Instead, the sink will pull on the stream, and will drain element-wise. This moves the whole stream to being lazy.
* Adds ctrl-c support and connects it into some of the key points where we pull on the stream. If a ctrl-c is detect, we immediately halt pulling on the stream and return to the prompt.
* Moves away from having a SourceMap where anchor locations are stored. Now AnchorLocation is kept directly in the Tag.
* To make this possible, split tag and span. Span is largely used in the parser and is copyable. Tag is now no longer copyable.
2019-10-13 17:12:43 +13:00
Yehuda Katz
ab915f1c44 Revert "Revert "Migrate most uses of the Span concept to Tag""
This reverts commit bee7c5639c.
2019-09-14 11:30:24 -05: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
540e93aa3a question mark character can also be in glob patterns. 2019-09-10 12:26:56 -05: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
Odin Dutton
d71206ed9e Implement WholeStreamCommand for all remaining commands 2019-08-19 15:16:39 +10:00
Jonathan Turner
eeed31837f cleanup 2019-08-10 08:49:43 +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
c231dd32cd
Multi shells (#254)
Add multi-shells
2019-08-08 05:49:11 +12:00
Jonathan Turner
99671b8ffc Move more parts to tags and away from spans 2019-08-05 20:54:29 +12:00
Jonathan Turner
6b7d9c1de0 Add glob to ls 2019-08-02 15:10:06 +12:00
Jonathan Turner
462f783fac initial change to Tagged<Value> 2019-08-01 13:58:42 +12:00
Yehuda Katz
5a8e041a48 Tests pass! 2019-07-23 15:22:11 -07:00
Jonathan Turner
15507f00fc Introduce CallInfo, which abstracts args, name_span, and source_map 2019-07-20 14:27:10 +12:00
Jonathan Turner
2ed46046bd Cleanup for upcoming release 2019-07-17 07:10:25 +12:00
Yehuda Katz
2da12aed56 Tests pass 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
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
68a04829cb Add more information to sysinfo 2019-06-21 13:35:51 +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
108439f3d1 Add basic obj path indexing 2019-06-14 13:59:13 +12:00
Jonathan Turner
f40089f29b Better cd and ls 2019-06-14 09:47:25 +12:00
Jonathan Turner
e94d1d2758 Add pretty errors to commands 2019-06-08 10:35:07 +12:00
Jonathan Turner
c050ce852b Lots of misc improvements 2019-06-03 19:41:28 +12:00
Yehuda Katz
625a356361 Data flows across commands via streams now 2019-05-23 00:23:06 -07:00
Yehuda Katz
261d7a793f Restructure and make commands uniform 2019-05-22 00:12:03 -07:00
Yehuda Katz
6b82e3a8a8 Simplify commands 2019-05-15 17:21:46 -07:00
Yehuda Katz
af1963d148 Remove dead code 2019-05-15 15:58:44 -07:00
Yehuda Katz
a5a34b88a8 More cleanup 2019-05-15 15:23:36 -07:00
Yehuda Katz
91f7d5384f Strip away a bit of cruft and add reject 2019-05-15 14:44:06 -07: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
e6da37f5be Continue prepping for object streams 2019-05-11 15:59:57 -07:00
Yehuda Katz
aa3fe0b0db Prep for streaming objects 2019-05-11 01:08:21 -07:00
Yehuda Katz
51e921b085 A bit more infra 2019-05-11 00:00:33 -07:00
Yehuda Katz
8f3b273337 objectshell initial commit 2019-05-10 09:59:12 -07:00