Commit Graph

654 Commits

Author SHA1 Message Date
Jonathan Turner
8df748463d
Getting ready for multiline scripts (#2737)
* WIP

* WIP

* WIP

* Tests are passing

* make parser more resilient

* lint
2020-11-10 05:27:07 +13:00
Chris Gillespie
0113661c81
Flag to clear history file (#2720) 2020-11-10 05:23:41 +13:00
Joseph T. Lyons
0ee054b14d
Fix to md errors (#2729)
* Fix to md errors

* Fix variable name and avoid typecasts
2020-11-07 06:40:53 +13:00
Jonathan Turner
cb8491cfee
Bump to 0.22 (#2726) 2020-11-04 07:31:41 +13:00
Leonhard Kipp
8196b031f8
Delete comments showing output of older nu version (#2717) 2020-11-03 19:29:13 +13:00
Darren Schroeder
50dd56d3c4
bugfix for when pathext ends in ';' (#2723) 2020-11-02 13:00:47 -06:00
Darren Schroeder
0f7e1d4d01
Support broad range of escape sequences (#2719)
* WIP

* changed to matches

* fixed a bug with osc

* changed back to if let because: clippy

* fixed example test
2020-10-30 15:06:15 -05:00
Chris Gillespie
f97561c416
Inode added to ls -l (#2711) 2020-10-31 06:39:01 +13:00
Darren Schroeder
4e17292a12
Seq for nushell (#2704)
* seq command - WIP

* why, oh why

* works with parameters

* widths should've been optional

* dbg messages

* working. rest had to be first.

* updated so that it outputs a table instead of just strings

* made to work with floats, allowed separator be more than 1 char

* clippy

* fixed tests

* changed terminator help desc

* commit to get ci moving again
2020-10-29 15:51:48 -05:00
Chris Gillespie
666fbbb0d1
Precision added to round cmd (#2710) 2020-10-29 16:14:08 +13:00
Leonhard Kipp
c6fe58467b
Change alias shape inference to proposal of RFC#4 (#2685)
* Change alias shape inference to proposal of RFC#4

* Remove commented code

* Fix typo

* Change comment to be more informative

* Make match statement to lookup in table

* Remove resolved question

https://github.com/nushell/nushell/pull/2685#discussion_r509832054

* Pick ...or_insert_dependency functions into pieces

Previously there was get_shape_of_expr_or_insert dependency, now there is
get_shape_of_expr and get_shape_of_expr_or_insert_dependency

2 new functions have been added: get_result_shape_of_math_expr and
get_result_shape_of_math_expr_or_insert_dependency

* Remove flattening of deep binary expressions

Previously deep binary expressions have been flattened through the insertion of
fake vars. This logic was quite complicated. Now if a variable depends on the
result shape of a binary expression and the result shape can't be computed,
the variable simply depends on the whole binary.

* Change Expression::Variable(Variable::It(...)) to Expression::Variable(...)

* Simplify get_result_shapes_in_math_expr

* Simplify infer_shapes_in_binary_expr

* Clarify comment

* Clarify comment

* Fix clippy lint

* Move check for real var into checked_insert

* Remove comment

* Rename var
2020-10-29 06:49:38 +13:00
Darren Schroeder
46d1938f5c
add unicode to char command to print any unicode character (#2709)
* parsing unicode literal strings into chars

* refactored code to use -u option

* nudge ci
2020-10-28 09:08:09 -05:00
Jonathan Turner
8229af7591
Improve parameter inference for blocks (#2708) 2020-10-28 07:47:11 +13:00
Jonathan Turner
ee76523507
Add in parameter inference for blocks (#2706) 2020-10-27 20:37:35 +13:00
Benoît C
c283db373b
Always escape non-literal arguments when running external command (#2697) 2020-10-27 16:33:40 +13:00
Jonathan Turner
a6fdee4a51
bump to 0.21.1 (#2702)
* bump to 0.21.1

* bump trash version
2020-10-26 21:10:06 +13:00
Jonathan Turner
6951fb440c
Remove it expansion (#2701)
* Remove it-expansion, take 2

* Cleanup

* silly update to test CI
2020-10-26 19:55:52 +13:00
Chris Gillespie
502c9ea706
Radix added to str decimal conversion (#2696) 2020-10-26 16:35:18 +13:00
Darren Schroeder
22f67be461
added some weather symbols back and changed to emoji (#2695) 2020-10-22 15:10:19 -05:00
Andrés N. Robalino
77ffd06715
Allow appending table literals. (#2693) 2020-10-22 03:26:30 -05:00
Chris Gillespie
1d833ef972
Set weather chars as emoji only (#2691) 2020-10-22 14:36:27 +13:00
morbatex
0d8064ed2d
Add rounding functionalties (#2672)
* added math round

* added math floor

* added math ceil

* added math.md examples

* moved the detection of nonnumerical values in ceil/floor/round

* math round now works on streams

* math floor now works on streams

* math ceil now works on streams
2020-10-22 13:18:27 +13:00
rjboas
cc06ea4d87
Add Tau constant (#2673)
Adds Tau constant using meval::Context.

Also adds a test to match pi's.

Note: Tau ends up not being more precise than 2*pi.

Resolves: #2258
2020-10-22 13:16:51 +13:00
Darren Schroeder
1eb28c6cb6
add heavy & none table border options (#2686) 2020-10-21 08:53:08 -05:00
Avery Harnish
f4d654d2a2
fix: remove duplicated "to" (#2682) 2020-10-21 05:35:43 +13:00
Andrés N. Robalino
5725e55abb
Flatten rows containing same sub-table columns with distinct column names. (#2684) 2020-10-20 05:37:40 -05:00
Andrés N. Robalino
b6d19cc9fa
Move command changes. Refactorings. (#2683)
Continuing on anchoring and improvements on Nu's overall internal commands (#2635).
`move column` sub command has been turned into the command `move` since
we use it to move exclusively columns. Examples added as well.

Fixed it to carry along any anchor locations that might be in place if
table to be moved originates from other sources.
2020-10-20 04:07:13 -05:00
Leonhard Kipp
400bc97e35
Add parser improvements (#2679)
* Add parser improvements

Previously everything starting with "$" was parsed as a column path.
With this commit applied, the lite_arg starting with $ is parsed as
the most appropriate thing
- $true/$false ==> Expression::Boolean
- $(...) ==> Invocation
- $it ==> ColumnPath
- Anything with at least one '.' ==> ColumnPath
- Anything else ==> Variable

* Ignore failing tests
2020-10-19 20:03:14 +13:00
Joseph T. Lyons
2fd464bf7b
Refactor to md and Add Padding for Pretty Flag (#2678)
* refactor and cleanup to md

* Add padding around values in each row

* Add padding to test

* Update code to satisfy Clippy and pass other failing tests
2020-10-19 19:58:24 +13:00
Luccas Mateus
e626522b3a
LS support for other number formatting (#2650)
* make sort-by fail gracefully if mismatched types are compared

* Added a test to check if sorted-by with invalid types exists gracefully

* Linter changes

* removed redundant pattern matching

* Changed the error message

* Added a comma after every argument

* Changed the test to accomodate the new err messages

* Err message for sort-by invalid types now shows the mismatched types

* Lints problems

* Changed unwrap to expect

* Added the -f flag to rm command

Now when you a use rm -f there will be no error message, even if the
file doesnt actually exist

* Lint problems

* Fixed the wrong line

* Removed println

* Spelling mistake

* Fix problems when you mv a file into itself

* Lint mistakes

* Remove unecessary filtering in most cases

* Allow the removal of sockets

* Conditional compilations to systems without socket

* Add a size-format option to ls command

* Added kib and mib formating

* Make patterns lowercase

* New subcommand to format, filesize

* Forgot the linter once more

* Remove the ls changes since its no longer needed

* CI mistakes

* Lint stuff

* Fix lint

* Added formatting for bytes

* fix lint

* Changed the usage comment
2020-10-17 06:15:40 +13:00
Joseph T. Lyons
bf2363947b
Add pretty flag to to md (#2640)
* First draft for adding a `pretty` flag to `to md`

* rustfmt

* Fix Clippy warnings

* rustfmt

* Using Clippy suggestion broken code, reverting and putting in a statement to ignore clippy warning

* Add test for `to md -p`
2020-10-15 16:20:55 +13:00
Andrés N. Robalino
2fb48bd6ac
Flatten command. (#2670) 2020-10-14 04:36:11 -05:00
Jonathan Turner
770e5d89f2
Bump to 0.21 (#2663) 2020-10-14 06:19:09 +13:00
Wyatt Carss
cfac8e84dd
Disable rustyline bracketed paste mode by default (#2659)
Multiline pastes wait for the user to hit enter before running,
because they enter a special paste mode in rustyline called
'bracketed paste' by default. This commit disables that mode
by default for nushell, causing multiline pastes to be executed
immediately, treating each new line as a separate command.
2020-10-13 19:33:36 +13:00
Chris Gillespie
38bdb053d2
Add tests for get_data_by_key (#2658)
* Add test for get_data_by_key

* Apply same order for ValuExt impl

* Nothing helper for tests

* Use get_data_by_key from ValueExt
2020-10-12 22:46:58 -05:00
Andrés N. Robalino
4e931fa73f
Extract out xpath to a plugin. (#2661) 2020-10-12 18:18:39 -05:00
Darren Schroeder
2573441e28
xpath command for nushell (#2656)
* xpath prototype

* new xpath engine is finally working

* nearly there

* closer

* working with list, started to add test, code cleanup

* broken again

* working again - time for some cleanup

* cleaned up code, added error handling and test

* update example, fix clippy

* removed commented char
2020-10-12 08:03:00 -05:00
RedlineTriad
5770b15270
Use iterator chain instead of string concat. (#2655)
* Use iterator chain instead of string concat

* Add regression test for multi-value lines
2020-10-10 18:30:48 +13:00
Andrés N. Robalino
973a8ee8f3
Allow config to work with column paths. (#2653)
Nu has many commands that allow the nuño to customize behavior such
as UI and behavior. Today, coloring can be customized, the line editor,
and other things. The more options there are, the higher the complexity
in managing them.

To mitigate this Nu can store configuration options as nested properties.

But to add and edit them can be taxing. With column path support we can
work with them easier.
2020-10-08 20:04:19 -05:00
Jonathan Turner
1159d3365a
Fix clippy lints (#2651) 2020-10-09 10:47:51 +13:00
Darren Schroeder
153320ef33
Added -1 back when determining term_width (#2646)
* Added -1 back

* retrigger checks

* removed the max

* fixed a mistake
2020-10-07 12:45:57 -05:00
Ingvar Stepanyan
ff236da72c
[wasi] Update time & instant crates (#2645)
* [wasi] Update time & instant crates

In https://github.com/nushell/nushell/pull/2643 instant was updated by adding it as a hard dependency in Cargo.toml, but it's better to avoid it and only update in Cargo.lock via `cargo update -p ...`.

Additionally, updated `time` crate so that now some basic commands like `ls` work too, although formatting is pretty bad.

* Update default terminal width to 80

If termsize can't return anything, use 80 chars (e.g. on WASI).
2020-10-07 15:26:16 +13:00
Jonathan Turner
f14f4e39c5
Begin adding wasi support (#2643)
* Begin adding wasi support

* Now it builds and runs but needs more help
2020-10-07 11:21:24 +13:00
Chris Gillespie
93410c470e
Bump dtparse to fix panic (#2632) 2020-10-07 06:27:06 +13:00
Andrés N. Robalino
5d945ef869
empty? rewrite. (#2641) 2020-10-06 05:21:20 -05:00
Joseph T. Lyons
df07be6a42
Fix to_md function name (#2636)
* Fix to_md function name

* rustfmt
2020-10-05 18:13:27 -05:00
Andrés N. Robalino
ae1d4bdb4c
Nushell internal commands. Anchor locations tracker surveying. (#2635) 2020-10-03 09:06:02 -05:00
Jonathan Turner
0adf2accdd
Fix defaulting alias var values (#2631) 2020-10-03 09:18:23 +13:00
Darren Schroeder
4201f48be5
Left Pad and Right Pad String (#2630)
* WIP

* left and right pad strings

* fixed some tests
2020-10-02 14:45:59 -05:00
Luccas Mateus
b076e375ca
Fix broken removal of sockets (#2629)
* make sort-by fail gracefully if mismatched types are compared

* Added a test to check if sorted-by with invalid types exists gracefully

* Linter changes

* removed redundant pattern matching

* Changed the error message

* Added a comma after every argument

* Changed the test to accomodate the new err messages

* Err message for sort-by invalid types now shows the mismatched types

* Lints problems

* Changed unwrap to expect

* Added the -f flag to rm command

Now when you a use rm -f there will be no error message, even if the
file doesnt actually exist

* Lint problems

* Fixed the wrong line

* Removed println

* Spelling mistake

* Fix problems when you mv a file into itself

* Lint mistakes

* Remove unecessary filtering in most cases

* Allow the removal of sockets

* Conditional compilations to systems without socket
2020-10-02 17:50:55 +13:00
Chris Gillespie
2f1016d44f
Add examples to update cmd (#2628) 2020-10-01 20:13:42 -05:00
Andrés N. Robalino
ddf9d61346
Line charts. Chart plugin sub command extraction. (#2627) 2020-10-01 19:23:10 -05:00
Chris Gillespie
e4c6336bd4
Convert to string before clip (#2624) 2020-10-01 18:22:19 +13:00
Luccas Mateus
66061192f8
Fix "mv allows moving a directory into itself" (#2619)
* make sort-by fail gracefully if mismatched types are compared

* Added a test to check if sorted-by with invalid types exists gracefully

* Linter changes

* removed redundant pattern matching

* Changed the error message

* Added a comma after every argument

* Changed the test to accomodate the new err messages

* Err message for sort-by invalid types now shows the mismatched types

* Lints problems

* Changed unwrap to expect

* Added the -f flag to rm command

Now when you a use rm -f there will be no error message, even if the
file doesnt actually exist

* Lint problems

* Fixed the wrong line

* Removed println

* Spelling mistake

* Fix problems when you mv a file into itself

* Lint mistakes

* Remove unecessary filtering in most cases
2020-10-01 14:01:05 +13:00
Andrés N. Robalino
a56abb6502
Bar Chart baseline. (#2621)
Bar Chart ready.
2020-09-30 13:27:52 -05:00
JonathanArns
f45adecd01
fix select for column names with spaces (#2613) 2020-09-30 10:00:07 +13:00
Chris Gillespie
cf43b74f26
did_you_mean without dependency (#2610) 2020-09-29 16:32:29 +13:00
Chris Gillespie
18909ec14a
Describe object now matches cmd name (#2603) 2020-09-27 14:54:47 +13:00
Chris Gillespie
ed243c88d2
Move non-essential deps into specific crates (#2601) 2020-09-26 18:32:52 +12:00
Jonathan Turner
cb7723f423
Refactor scope (#2602)
* Refactor scope to have parents

* Refactor scope to have parents

* Refactor scope to have parents

* Clippy

Co-authored-by: Jonathan Turner <jonathan@pop-os.localdomain>
2020-09-26 11:40:02 +12:00
tumdum
9dc88f8a95
Add env var during benchmark to randomize stack (#2600) 2020-09-26 10:57:48 +12:00
Chris Gillespie
a8b65e35ec
Consolidate suggestions code (#2597) 2020-09-25 15:44:24 +12:00
Chris Gillespie
bd9e598bf0
did_you_mean returns just the word matches (#2595) 2020-09-24 15:56:19 +12:00
Luccas Mateus
e8ec5027ff
remove without check path exist, rm -f (#2590) 2020-09-22 17:11:31 -04:00
Jonathan Turner
ebba89ea31
Bump to 0.20 (#2588) 2020-09-22 19:54:46 +12:00
Chris Gillespie
b133724b38
Add space between column suggestions (#2586) 2020-09-22 14:14:11 +12:00
Radek Vít
09429d08aa
Implement passthrough for benchmark (#2580)
* Implement passthrough for benchmark

Add a new option -p,--passthrough to benchmark.
With this option, the benchmark command prints its results to stdout and passes the block's output to the next command in the pipeline.

* Add execution block for benchmark -p

`benchmark --passthrough` now takes a block where the benchmark output is sent.
Example:
`benchmark -p {save bench.toml} {ls}`
2020-09-22 05:30:16 +12:00
Jonathan Turner
9b577b8679
Update bigint/bigdecimal (#2585)
* Update bigint/bigdecimal

* clippy
2020-09-22 05:28:31 +12:00
Shaurya
7a595827f1
Fix subcommands column on help commands (#2584) 2020-09-21 19:57:26 +12:00
Matt Clarke
332e12ded0
Added test for ls -a (#2582) 2020-09-21 19:56:37 +12:00
Chris Gillespie
a508e15efe
CtrlD exits current shell (#2583) 2020-09-21 19:56:10 +12:00
Radek Vít
a5b6bb6209
Add global mode to str trim (#2576)
* Add global mode to str trim

The global mode allows skipping non-string values,
and processes rows and tables as well

* Add tests to action with ActionMode::Global
2020-09-20 21:04:26 +12:00
Jonathan Turner
1882a32b83
Context cleanup (#2581)
* Specialize 'Context' to EvaluationContext and CompletionContext

* Specialize 'Context' to EvaluationContext and CompletionContext

* fmt
2020-09-20 09:29:51 +12:00
Radek Vít
798766b4b5
Remove panics from random integer and make the constraint more idiomatic (#2578)
* Remove panics from random integer and make the constraint more idiomatic

* Add open intervals to NumericRange
2020-09-20 08:41:49 +12:00
Shaurya
193c4cc6d5
Include subcommands in help commands (#2575)
* Add minor fixes to comments

* Include subcommands in `help commands`
2020-09-20 08:37:47 +12:00
Radek Vít
422b6ca871
Add system, user and idle times to benchmark command (#2571)
* Add system, user and idle times to benchmark command

* Feature-gate dependency on heim in benchmark

* Reorder let bindings in benchmark

* Fully feature-gate rich-benchmark and print 0sec on zero duration
2020-09-20 05:13:14 +12:00
Darren Schroeder
2b13ac3856
more table themes rounded and reinforced (#2579) 2020-09-19 12:10:34 -05:00
Chris Gillespie
4c10351579
Exclude internal commands from 'help command' (#2573) 2020-09-19 11:48:30 +12:00
Jonathan Turner
dd27aaef1b
Limit open streaming to non-files, and files > 32mb (#2570) 2020-09-19 07:51:28 +12:00
Darren Schroeder
6eb4a0e87b
add replace all option to str find-replace (#2569) 2020-09-18 11:28:50 -05:00
Radek Vít
15f3a545f0
Cleanup code in get and nu-value-ext (#2563)
* Cleanup code in get and nu-value-ext

* Remove unnecessary return statements from get
2020-09-18 18:40:20 +12:00
Chris Gillespie
365f76ad19
Tidy up help command text (#2566) 2020-09-18 18:13:53 +12:00
rezural
df2845a9b4
implementing case-sensitive & case-insensitive completion matching (#2556)
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-09-17 10:52:58 -04:00
Jonathan Turner
8453261211
Update rustyline to latest (#2565)
* Update rustyline to latest

* Go ahead and use rustyline for testing
2020-09-17 18:02:30 +12:00
Radek Vít
1dc8f3300e
Make the sleep command pass data through. (#2558) 2020-09-16 19:34:37 -04:00
Andrés N. Robalino
10d4edc7af
Slim down configuration readings and nu_cli clean up. (#2559)
We continue refactoring nu_cli and slim down a bit configuration
readings with a naive metadata `modified` field check.
2020-09-16 18:22:58 -05:00
Chris Gillespie
50cbf91bc5
Remove trim in favor of str trim (#2560) 2020-09-16 15:59:32 -04:00
Radek Vít
d05f9b3b1e
Make the sleep command respond to Ctrl+C (#2550) 2020-09-16 12:14:33 -04:00
Jason Gedge
f5fad393d0
Refactor completion trait (#2555)
* Remove completion code from help/value shells

* Tweak the `Completer` trait for nushell.

Previously, this trait was built around rustyline's completion traits, and for
`Shell` instances. Now it is built for individual completers inside of nushell
that will complete a specific location based on a partial string. For example,
for completing a partially typed command in the command position.
2020-09-16 16:37:43 +12:00
Darren Schroeder
d19a5f4c2f
add a few more ansi escape sequences (#2553) 2020-09-15 16:01:57 -05:00
Darren Schroeder
04451af776
Ctrl c exit issue (#2548)
* fix ctrl_c problem on windows

* updated cargo.lock
2020-09-15 09:59:51 -05:00
Andrés N. Robalino
0178b53289
Core nu plugin load capability. (#2544)
We introduce the `plugin` nu sub command (`nu plugin`) with basic plugin
loading support. We can choose to load plugins from a directory. Originally
introduced to make integration tests faster (by not loading any plugins on startup at all)
but `nu plugin --load some_path ; test_pipeline_that_uses_plugins_just_loaded` does not see it.

Therefore, a `nu_with_plugins!` macro for tests was introduced on top of nu`s `--skip-plugins`
switch executable which is set to true when running the integration tests that use the `nu!` macro now..
2020-09-14 09:07:02 -05:00
Chris Gillespie
e05e6b42fe
Simplify a few boolean creations (#2543) 2020-09-14 13:15:44 +12:00
Radek Vít
599bb9797d
Implement exclusive and inclusive ranges with ..< and .. (#2541)
* Implement exclusive and inclusive ranges with .. and ..=

This commit adds right-exclusive ranges.

The original a..b inclusive syntax was changed to reflect the Rust notation.
New a..=b syntax was introduced to have the old behavior.

Currently, both a.. and b..= is valid, and it is unclear whether it's valid
to impose restrictions.

The original issue suggests .. for inclusive and ..< for exclusive ranges,
this can be implemented by making simple changes to this commit.

* Fix collect tests by changing ranges to ..=

* Fix clippy lints in exclusive range matching

* Implement exclusive ranges using `..<`
2020-09-14 09:53:08 +12:00
Chris Gillespie
c355585112
Set active shell column to boolean (#2540) 2020-09-13 16:25:38 +12:00
gorogoroumaru
45f32c9541
Allow math avg to work on durations (#2529)
* Allow `math avg` to work on durations

* formatting

* fix linting issue and implemented `math sum` for duration

* fix linting issue

* applied requested changes

* applied requested change for avg.rs

* formatting
2020-09-12 18:56:05 -05:00
Andrés N. Robalino
7528094e12
Allow folding with tables. (#2538) 2020-09-12 01:40:52 -05:00
Yusuke Ito
dcfa135ab9
support key-value argument in with-env(#2490) (#2530)
* support key-value argument in with-env

* remove unused import

* fix format for lint
2020-09-11 18:17:35 +12:00
Yusuke Ito
e9bb4f25eb
accept multiple variables in with-env(#2490) (#2526)
* accept multiple variables in with-env(#2490)

* add examples for test

* fix format(#2490)
2020-09-10 19:23:28 +12:00
Jason Gedge
73e65df5f6
Fix path completions for cd command. (#2525)
Previously, we weren't expanding `~`, so `std::fs::metadata` was failing. We now
make use of `PathSuggestion` to get the actual path, as represented by a
`PathBuf`.
2020-09-09 18:32:20 -04:00