Commit Graph

29 Commits

Author SHA1 Message Date
c0be02a434 Short-hand flags (#1378)
* typo fixes

* Change signature to take in short-hand flags

* update help information

* Parse short-hand flags as their long counterparts

* lints

* Modified a couple tests to use shorthand flags
2020-02-11 18:24:31 -08:00
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
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
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
fbd980f8b0 Add descriptions to arguments 2019-10-28 18:15:35 +13:00
ab915f1c44 Revert "Revert "Migrate most uses of the Span concept to Tag""
This reverts commit bee7c5639c.
2019-09-14 11:30:24 -05:00
bee7c5639c Revert "Migrate most uses of the Span concept to Tag" 2019-09-11 19:53:05 +12:00
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
b15bb2c667 Added glob patterns to the syntax shapes
Bare words now represent literal file names, and globs are a different
syntax shape called "Pattern". This allows commands like `cp` to ask for
a pattern as a source and a literal file as a target.

This also means that attempting to pass a glob to a command that expects
a literal path will produce an error.
2019-09-10 09:00:50 -07:00
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
f730296e45 WIP supporting from/to automatically 2019-08-29 15:53:45 +12:00
721a7b159d switch from reqwest to surf 2019-08-25 07:36:19 +12:00
e012e04da0 Disallow fileops on values 2019-08-22 05:03:59 +12:00
1e8793135a Mark the unwrap and Sweep the unwrap a bit more. 2019-08-21 10:48:04 -05:00
8d5fd6f379 Unwrap cleanup mitigation. 2019-08-21 10:08:38 -05:00
5dd20850b5 Refactoring and unwrap cleanup beginnings. 2019-08-18 20:28:55 -05:00
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
dd18122a24 WIP 2019-08-15 17:02:02 +12:00
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
278de0e517 cp refactoring. 2019-08-14 15:29:05 -05:00
6cf3dc92fc Add support for utf16 files 2019-08-12 16:11:42 +12:00
aadacc2d36 Merge master 2019-08-09 16:51:21 +12:00
ba6d62ea0c mkdir creates intermediary directories as required (the default). --create-all/--deep flag removed. 2019-08-07 14:38:00 -05:00
50393bdf42 Make more visible the strategies for figuring out where to copy files. 2019-08-07 13:42:52 -05:00
e0bacaaf37 clean up. more cp. mkdir. more test coverage. fixes.
- Introduced mkdir.
- Minor more labelled error improvements.
- Fix to avoid leaking child zombies.
- cp improvements.
- Introduced mkdir.
2019-08-07 13:28:46 -05:00
1b7dd52713 Tests pass. 2019-08-07 13:23:02 -05:00
c231dd32cd Multi shells (#254)
Add multi-shells
2019-08-08 05:49:11 +12:00
0790a714b0 Appropiate error handling when copying (thanks @jonathandturner) 2019-07-23 01:03:35 -05:00
2da43f4b06 Introduced initial cp functionality. 2019-07-21 21:23:02 -05:00