Commit Graph

82 Commits

Author SHA1 Message Date
Jonathan Turner
c3535b5c67
It-expansion fixes (#1757)
* It-expansion fixes

* fix clippy
2020-05-12 15:58:16 +12:00
Jonathan Turner
8b9a8daa1d
Add a batch of help examples (#1755) 2020-05-12 13:00:55 +12:00
Jonathan Turner
c5ea4a31bd
Adding coloring to help examples (#1754) 2020-05-12 11:06:40 +12:00
Jonathan Turner
2275575575
Improve list view and ranges (#1753) 2020-05-12 08:06:09 +12:00
Elichai Turkel
c3a066eeb4
Add examples to commands (#1752)
* Pass &dyn WholeStreamCommand to get_help

* Add an optional example to the WholeStreamCommand trait

* Add an example to the alias command
2020-05-12 08:05:44 +12:00
Jonathan Turner
42eb658c37
Add a simplified list view (#1749) 2020-05-11 14:47:27 +12:00
Jonathan Turner
a2e9bbd358
Improve duration math and printing (#1748)
* Improve duration math and printing

* Fix test
2020-05-11 13:44:49 +12:00
Joseph T. Lyons
f702aae72f
Don't include year and month by default, adds an option to display th… (#1745)
* Don't include year and month by default, adds an option to display the quarters of the year

* Add a test for cal that checks that year requested is in the return

* rustfmt the cal tests
2020-05-11 12:35:24 +12:00
Joseph T. Lyons
f5e03aaf1c
Add cal command (#1739)
* Add cal command

* Fix docmentation to show commands on two lines

* Use bullet points on flag documentation for cal

* Dereference day before calling string method

* Silence Clippy warning regarding a function with too many arguments

* Update cal flag descriptions and documentation

* Add some tests for the cal command
2020-05-10 11:05:48 +12:00
chrisr
55374ee54f
Fix help text for alias command. (#1742)
* Fix help text for alias command.

* Rust fmt
2020-05-09 12:16:14 -05:00
Andrés N. Robalino
f93ff9ec33
Make grouping more flexible. (#1741) 2020-05-09 12:15:47 -05:00
Andrés N. Robalino
96e5fc05a3
Pick->Select rename. Integration tests changes. (#1725)
Pick->Select rename. Integration tests changes.
2020-05-07 06:03:43 -05:00
Andrés N. Robalino
c3efdf2689
Rename edit command to update. (#1724)
Rename edit command to update.
2020-05-07 00:33:30 -05:00
Jason Gedge
27fdef5479
Read exit status before failing in failed read from stdout pipe (#1723) 2020-05-07 13:42:01 +12:00
Jonathan Turner
7ce8026916
Ignore empty arguments passed to externals (#1722) 2020-05-07 09:18:56 +12:00
Jonathan Turner
b37e420c7c
Add with-env command (#1717) 2020-05-06 15:56:31 +12:00
Jörn Zaefferer
3201c90647
Extend to/from usage text to indicate subcommands (#1711)
Both to and from without a subcommand only print the helptext. Expand the usage line a bit, so a glance at `help commands` indicates the existance of the subcommands and mentions some common formats.

Ref a9968046ed
Ref #1708
2020-05-05 09:00:29 +12:00
Jonathan Turner
454f560eaa
Properly deserialize history args (#1710) 2020-05-05 07:50:10 +12:00
Jonathan Turner
a9968046ed
Add subcommands. Switch from-* and to-* to them (#1708) 2020-05-04 20:44:33 +12:00
Jonathan Turner
453087248a
Properly drain iterating pipe so we can see errors (#1707) 2020-05-04 15:29:32 +12:00
Joseph T. Lyons
8d69c77989
Display either dir metadata size or dir apparent size in ls (#1696)
* Show dir size in ls command

* Add the option to show the apparent directory size via `ls --du`
2020-05-03 17:09:17 +12:00
Jonathan Turner
7d403a6cc7
Escape some symbols in external args (#1687)
* Escape some symbols in external args

* Don't escape on Windows, which does its own

* fix warning
2020-04-30 16:54:07 +12:00
Andrés N. Robalino
cf53264438
Table operating commands. (#1686)
* Table operating commands.

* Updated merge test for clarity.

* More clarity.

* Better like this..
2020-04-29 23:18:24 -05:00
Jonathan Turner
d834708be8
Finish remove the last traces of per-item (#1685) 2020-04-30 14:23:40 +12:00
Jonathan Turner
db8219e798
extend it-expansion to externals (#1682)
* extend it-expansion to externals

* trim the carriage return for external strings
2020-04-30 07:09:14 +12:00
Kevin Del Castillo
c704157bc8
Replace ichwh with which and some fixes for auto-cd (canonicalization) (#1672)
* fix: absolutize path against its parent if it was a symlink.

On Linux this happens because Rust calls readlink but doesn't canonicalize the resultant path.

* feat: playground function to create symlinks

* fix: use playground dirs

* feat: test for #1631, shift tests names

* Creation of FilesystemShell with custom location may fail

* Replace ichwh with which

* Creation of FilesystemShell with custom location may fail

* Replace ichwh with which

* fix: add ichwh again since it cannot be completely replaced

* fix: replace one more use of which
2020-04-28 05:49:53 +12:00
Jonathan Turner
006171d669
Fix per-item run_alias (#1669)
* Fix per-item run_alias

* Fix 1609 also
2020-04-27 18:10:34 +12:00
Jonathan Turner
8bd3cedce1
It expansion (#1668)
* First step in it-expansion

* Fix tests

* fix clippy warnings
2020-04-27 14:04:54 +12:00
Jason Gedge
6f2ef05195
Resolves https://github.com/nushell/nushell/issues/1658 (#1660)
For example, when running the following:

    crates/nu-cli/src

nushell currently parses this as an external command. Before running the command, we check to see if
it's a directory. If it is, we "auto cd" into that directory, otherwise we go through normal
external processing.

If we put a trailing slash on it though, shells typically interpret that as "user is explicitly
referencing directory". So

    crates/nu-cli/src/

should not be interpreted as "run an external command". We intercept a trailing slash in the head
position of a command in a pipeline as such, and inject a `cd` internal command.
2020-04-27 13:22:01 +12:00
Andrés N. Robalino
80025ea684
Rows and values can be checked for emptiness. Allows to set a value if desired. (#1665) 2020-04-26 12:30:52 -05:00
rimathia
a62745eefb
make trim apply to strings contained in tables (also at deeper nesting (#1664)
* make trim apply to strings contained in tables (also at deeper nesting
levels), not just top-level strings

* remove unnecessary clone (thanks clippy)
2020-04-27 05:26:02 +12:00
Jonathan Turner
2ac501f88e
Adds drop number of rows command (#1663)
* Fix access to columns with quoted names

* Add a drop number of rows from end of table
2020-04-26 18:34:45 +12:00
Adam Shirey
ad8ab5b04d
Add from-eml command (#1656)
* from-eml initial ver

* Adding tests for `from-eml`

* Add eml to prepares_and_decorates_filesystem_source_files

* Sort the file order

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-04-26 16:26:35 +12:00
Andrés N. Robalino
0e510ad42b
Values can be used as keys for grouping. (#1648) 2020-04-23 20:55:18 -05:00
Lars Mühmel
b3c623396f
Fix to-csv command (#1635)
* Fix --headerless option of to-csv and to-tsv

Before to-csv --headerless split the "headerfull" output on lines,
skipped the first, and then concatenated them together. That meant
that all remaining output would be put on the same line, without
any delimiter, making it unusable. Now we replace the range of the
first line with the empty string, maintaining the rest of the
output unchanged.

* Remove extra space in indentation of to_delimited_data

* Add --separator <string> argument to to-csv

This functionaliy has been present before, but wasn't exposed
to the command.
2020-04-23 05:08:53 +12:00
Jonathan Turner
ce0231049e
Fix the panic running a bad alias (#1624) 2020-04-21 16:11:34 +12:00
Jonathan Turner
0f7b270740
Add exit code verification (#1622) 2020-04-21 15:14:18 +12:00
Jonathan Turner
72cf57dd99
Add booleans and fix semicolon shortcircuit (#1620) 2020-04-21 12:30:01 +12:00
Jonathan Turner
e4fdb36511
External vars (#1615)
* fix empty table and missing spans

* wip

* WIP

* WIP

* working version with vars

* tidying

* WIP

* Fix external quoting issue
2020-04-21 09:45:11 +12:00
Jonathan Turner
2ffb14c7d0
fix empty table and missing spans (#1614) 2020-04-20 19:44:19 +12:00
Jonathan Turner
eec94e4016
Semicolon (#1613)
* WIP on blocks

* Getting further

* add some tests
2020-04-20 18:41:51 +12:00
Jonathan Turner
6412bfd58d
Move alias arguments to optional arguments (#1612)
This will allow people to use more variables to capture more, if necessary, without having to implement required/optional/rest
2020-04-20 16:04:40 +12:00
Jason Gedge
522a828687
Move external closer to internal (#1611)
* Refactor InputStream and affected commands.

First, making `values` private and leaning on the `Stream` implementation makes
consumes of `InputStream` less likely to have to change in the future, if we
change what an `InputStream` is internally.

Second, we're dropping `Option<InputStream>` as the input to pipelines,
internals, and externals. Instead, `InputStream.is_empty` can be used to check
for "emptiness". Empty streams are typically only ever used as the first input
to a pipeline.

* Add run_external internal command.

We want to push external commands closer to internal commands, eventually
eliminating the concept of "external" completely. This means we can consolidate
a couple of things:

- Variable evaluation (for example, `$it`, `$nu`, alias vars)
- Behaviour of whole stream vs per-item external execution

It should also make it easier for us to start introducing argument signatures
for external commands,

* Update run_external.rs

* Update run_external.rs

* Update run_external.rs

* Update run_external.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-04-20 15:30:44 +12:00
Jonathan Turner
7974e09eeb
Math operators (#1601)
* Add some math operations

* WIP for adding compound expressions

* precedence parsing

* paren expressions

* better lhs handling

* add compound comparisons and shorthand lefthand parsing

* Add or comparison and shorthand paths
2020-04-18 13:50:58 +12:00
Jonathan Turner
52d2d2b888
A random set of fixes (#1600) 2020-04-17 18:19:49 +12:00
Jonathan Turner
ee778d2b03
WIP fix for the error bubbling (#1597) 2020-04-16 16:25:24 +12:00
Jonathan Turner
bd5836e25d
Aliases (#1589)
* WIP getting scopes right

* finish adding initial support

* Finish with alias and add startup commands
2020-04-15 17:43:23 +12:00
Jonathan Turner
e3da037b80
Canonical expr block (#1584)
* Add the canonical form for an expression block

* Remove commented out code
2020-04-14 06:59:33 +12:00
Jonathan Turner
08a09e2273
Pipeline blocks (#1579)
* Making Commands match what UntaggedValue needs

* WIP

* WIP

* WIP

* Moved to expressions for conditions

* Add 'each' command to use command blocks

* More cleanup

* Add test for 'each'

* Instead use an expression block
2020-04-13 19:59:57 +12:00
Jonathan Turner
85d6b24be3
Add more cmd builtins (#1583) 2020-04-13 13:46:59 +12:00