Commit Graph

833 Commits

Author SHA1 Message Date
Jonathan Turner
c012d648fb
Add experimental support for flags in custom commands (#2808)
* Add experimental support for flags in custom commands

* clippy
2020-12-21 20:36:59 +13:00
Jonathan Turner
67acaae53c
Rename cond math (#2807)
* Simplifies 'if' to work on the available scope rather than a stream

* Rename initializer/math for better readability

* Fix description

* fmt
2020-12-21 17:32:06 +13:00
Jonathan Turner
e3da546e23
Simplifies 'if' to work on the available scope rather than a stream (#2805) 2020-12-21 16:02:39 +13:00
Jonathan Turner
e5b136f70d
Add script sourcing (#2803)
* Add script sourcing

* clippy
2020-12-19 20:47:34 +13:00
Jonathan Turner
058ef69da3
Add set-env for setting environment variables (#2802) 2020-12-19 19:25:03 +13:00
Jonathan Turner
05202671db
Improve errors on success (#2801) 2020-12-19 18:24:56 +13:00
Jonathan Turner
8509873043
Parse mid-line comments (#2800) 2020-12-19 11:23:02 +13:00
Jonathan Turner
57a2d695e2
Removing the defs inside of blocks for now (#2798) 2020-12-19 07:53:00 +13:00
Jonathan Turner
0b5ab1ef22
Don't print a nothing value (#2796) 2020-12-19 05:48:22 +13:00
Darren Schroeder
2eac79569c
highlight trailing spaces in tables in darkgray (#2794)
* highlight trailing spaces in tables in darkgray

* added leading spaces highlighting

* added config point to change the color

* Trigger Build
2020-12-18 07:47:05 -06:00
Jonathan Turner
ac578b8491
Multiline scripts part 2 (#2795)
* Begin allowing comments and multiline scripts.

* clippy

* Finish moving to groups. Test pass

* Keep going

* WIP

* WIP

* BROKEN WIP

* WIP

* WIP

* Fix more tests

* WIP: alias starts working

* Broken WIP

* Broken WIP

* Variables begin to work

* captures start working

* A little better but needs fixed scope

* Shorthand env setting

* Update main merge

* Broken WIP

* WIP

* custom command parsing

* Custom commands start working

* Fix coloring and parsing of block

* Almost there

* Add some tests

* Add more param types

* Bump version

* Fix benchmark

* Fix stuff
2020-12-18 20:53:49 +13:00
Jonathan Turner
5183fd25bb
Bump version (#2792) 2020-12-16 09:13:18 +13:00
Mike Boutin
10f5a8ef78
Update uom and heim dependencies (#2767)
v0.29.0 and earlier versions of `uom` fail to compile on nightly because
of now-ambiguous trait bounds. The issue was corrected in v0.30.0 of
`uom`. `uom` and `heim` dependencies have been updated to the
latest version to include this fix and allow nushell to compile on
nightly.

Co-authored-by: Boutin, Michael <mjboutin@ecolab.com>
2020-12-15 13:27:21 -06:00
Jonathan Turner
a30837298d
Bump version (#2791) 2020-12-16 06:30:50 +13:00
xolve
f377a3a7b4
Added math abs command. (#2789) 2020-12-16 05:37:12 +13:00
Stan Zhang
83c874666a
Date utility commands (#2780)
* updated & added date related commands based on the new design

* added proper error handling when date format string is invalid

* fixed format issue

* fixed an issue caused due to the change in primitive Date type

* added `date list-timezone` command to list all supported time zones and updated `date to-timezone` accordingly
2020-12-12 12:18:03 -06:00
Chris Gillespie
af2f064f42
Add random chars cmd (#2782) 2020-12-09 06:43:46 +13:00
Dietrich Daroch
9c7b25134b
Parsing: Explain parsing errors and show sample lines. (#2774)
This makes the errors slightly better. It took me a while to realize I was missing the `--raw` flag.

```
open "data.csv" | from csv --separator ';'
```

    error: Could not parse as CSV split by ',' (Line 1: expected 1 fields, found 14)
      ┌─ shell:1:1
      │
    1 │ open "data.csv" | from csv --separator ';'
      │ ^^^^ ------------------------------------------------- value originates from here
      │ │
      │ input cannot be parsed as CSV split by ','. Sample input:
    Name;Data
    Ugly;row
    AnotherUgly;row

I think this still needs some refinement. Maybe we don't want to show
the separator all the time, omitting the defaults or the separator
on other formats.
2020-12-07 07:19:04 +13:00
Jonathan Turner
2d15df9e6c
Revert "Bump Rustyline to 7.0.0 (#2776)" (#2778)
This reverts commit e73278990c.
2020-12-05 17:12:42 +13:00
Andrés N. Robalino
d2ab287756
Tell Nu to look for hash's rest columns paths first. (#2777) 2020-12-04 13:49:58 -05:00
Chris Gillespie
e73278990c
Bump Rustyline to 7.0.0 (#2776)
* Bump Rustyline to 7.0.0

* Append history instead of always save

* Add associated type to Hinter

* Convert to using Rustyline KeyEvent

* Use AcceptOrInsertLine as struct

* Cargo fmt

* Make convert_keyevent pub

* Better naming for RL conversion
2020-12-05 06:29:40 +13:00
Maximilian Roos
12bc92df35
Make run_block public (#2772) 2020-12-02 23:00:30 +13:00
Darren Schroeder
f19a801022
enhanced version command with more info (#2773) 2020-12-01 13:57:49 -06:00
Ryan Blecher
b193303aa3
Add hash command with base64 subcommand (#2769)
* WIP try testing hash command

Ensure test worked

fmt

WIP get it working for other types of base64

Use optional named arg

WIP

* rebased and refactored a little with encoding and decoding

Fix some typos

Add some more charactersets

refactor several args into the encoding config struct and fix character_set arg. It needs to match the field

Add main hash command so it can be found via help

Added tests for running the whole pipeline

* add test case to cover invalid character sets

* clippy and fmt
2020-12-01 06:47:35 +13:00
Jonathan Turner
e299e76fcf
Bump to 0.23 (#2766) 2020-11-25 07:22:27 +13:00
Andrés N. Robalino
c857e18c4a
Avoid subtract overflow when no ending index given. (#2764) 2020-11-24 05:50:38 -05:00
smaydew
5fb3df4054
Initial implementation of the random decimal subcommand. (#2762)
Co-authored-by: Stacy Maydew <stacy.maydew@starlab.io>
2020-11-24 22:19:48 +13:00
Jakub Žádník
8b597187fc
Path Command Enhancement Project (#2742)
* Add string argument support for path subcommands

* Add --replace option to 'path extension' command

* Add examples of replacing for path extension

* Refactor path extension and its example

* Add replacement functionality to path basename

* Refactor path subcommands to support more args

This adds a lot of redundancy to non-relevant subcommands such as type,
exists or expand.

* Add replace and num_levels options to path dirname

* Rename num_levels option to num-levels

* Remove commented code

* Clean up path basename

* Fix path dirname description

* Add path filestem opts; Rename extension -> suffix

* Add prefix option and examples to path filestem

* Fix broken num-levels of path dirname

* Fix failing example test of path filestem

* Fix failing test of path extension

* Formatting

* Add Windows-specific path subcommand examples

`path expand` is still broken but otherwise seems to fix all examples
on Windows

* Fix weird path expand on Windows

Also disable example tests for path expand. Failed caconicalization
(e.g., due to path not existing) returns the original path so the
examples always fail.

* Formatting

* Return path datatype when appropriate

* Do not append empty remainder to path dirname

* Add tests for path subcommands

* Formatting

* Revisit path subcommand description strings

* Apply clippy suggestions; Formatting

* Remove problematic test checking '~' expansion

Wouldn't run on minimal due to useing optional dependency.
The test success was also deending on the presence of home dir on the
testing machine which might not be completely robust.

* Add missing newline to file
2020-11-24 22:18:38 +13:00
Jonathan Turner
930f9f0063
Fix new clippy warnings (#2760)
* Fix new clippy warnings

* Fork serde-hjson and bring in

* Fork serde-hjson and bring in

* Fix clippy lint again
2020-11-22 13:37:16 +13:00
Darren Schroeder
13ba533fc4
helps table columns align a little bit better (#2753)
* helps table columns align a little bit better

* no change to push CI to work again.
2020-11-18 07:18:12 -06:00
Darren Schroeder
b412ff92c0
Seq with dates (#2746)
* seq with dates - wip

* everything seems to be working, yay!

* clippy
2020-11-11 14:35:02 -06:00
Jonathan Turner
5a75e11b0e
Revert "Getting closer to multiline scripts (#2738)" (#2745)
This reverts commit e66bf70589.
2020-11-10 18:22:13 +13:00
Jonathan Turner
e66bf70589
Getting closer to multiline scripts (#2738)
* Begin allowing comments and multiline scripts.

* clippy

* Finish moving to groups. Test pass
2020-11-10 16:52:42 +13:00
Darren Schroeder
3924e9d50a
added as_html switch so a selector can be passed to a selector (#2739) 2020-11-09 13:37:32 -06:00
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
Darren Schroeder
97f3671e2c
web scraping with css selectors (#2725)
* first step of making selector

* wip

* wip tests working

* probably good enough for a first pass

* oops, missed something.

* and something else...

* grrrr version errors
2020-11-03 15:46:42 -06:00
Jonathan Turner
b674cee9d2
Remove the recursely-dep'd tests (#2727) 2020-11-04 09:26:07 +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
Darren Schroeder
ec77c572b9
handle precision a tiny bit better than just hard coding to 4 decimal places. (#2712) 2020-10-31 06:40:28 +13: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