Commit Graph

81 Commits

Author SHA1 Message Date
Joseph T. Lyons
306dc89ede
Add bool subcommand to random (#2061)
* Add bool subcommand to random

* Fix function name copy paste error

* Fix issue 2062: allow deserialization of a decimal

* Add bias flag to `random bool`
2020-06-26 16:51:05 +12:00
Joseph T. Lyons
72a21ad619
Adds random command with uuid subcommand (#2050) 2020-06-25 17:51:09 +12:00
bailey-layzer
7532618bdc
Add error for division by zero using "=" (#2002) (#2030)
* error for division by zero with =

* cargo fmt

* add helper zero_division_error

* tests for zero division error

* fix test names (zero div error)
2020-06-22 08:50:43 +12:00
HiranmayaGundu
e3e1e6f81b
Adds a test case for changing drives using drive letter in Windows (#2022)
* added test case to test check switching drives using drive letter in windows

* modified test case to not use config, assert file exists
2020-06-22 07:02:58 +12:00
siedentop
bce6f5a3e6
Uniq: --count flag to count occurences (#2017)
* uniq: Add counting option (WIP!)

Usage:

fetch https://raw.githubusercontent.com/timbray/topfew/master/test/data/access-1k | lines | wrap item | uniq | sort-by count | last 10

* uniq: Add first test

* uniq: Re-enable the non-counting variant.

* uniq: Also handle primitive lines.

* uniq: Update documentation

* uniq: Final comment about error handling. Let's get some feedback

* uniq: Address review comments.

Not happy with the way I create a TypeError. There must be a cleaner
way. Anyway, good for shipping.

* uniq: Use Labeled_error as suggested by jturner in chat.

* uniq: Return error directly.

Co-authored-by: Christoph Siedentop <christoph@siedentop.name>
2020-06-21 12:22:06 +12:00
Andrés N. Robalino
b0c30098e4
Sort primitives explictly. (#2016)
* Sort primitives explictly.

* Write backing up test.
2020-06-19 23:34:36 -05:00
Joseph T Lyons
088901b24f Rename average to avg 2020-06-19 18:59:00 -05:00
Joseph T. Lyons
bc9cc75c8a
Minor Math Sum Additions (#2007)
* Move sum tests into math directory

* Move sum documentation over to math documentation

One sum example already existed in the math examples and a few of the others were outdated and didn't work, so I only moved one over, and updated their output

* Remove no-longer-in-use mod statement
2020-06-20 06:00:18 +12:00
Joseph T. Lyons
53a6e9f0bd
Convert sum command into subcommand of the math command (#2004)
* Convert sum command into subcommand of the math command

* Add bullet points to math.md documentation
2020-06-18 21:02:01 -05:00
Andrés N. Robalino
5f9de80d9b Math#media - ability to compute median value. 2020-06-18 16:59:43 -05:00
Joseph T. Lyons
353b33be1b
Add support to allow the week day start in cal to be configured via a flag (#1996)
* Add support to allow the week day start in cal to be configurable

* Fix variable name

* Use a flag instead of a configuration setting for specifying the starting day of the week
2020-06-19 05:34:51 +12:00
Andrés N. Robalino
96d58094cf Fix regression. skip-until 'skips' until condition is met. 2020-06-17 14:08:09 -05:00
Jakub Žádník
3d63901b3b
Add 'every' command to select (or skip) every nth row (#1992)
* Add 'every' command

* Add --skip option to 'every' command

This option skips instead of selects every nth row

* Fix descriptions for 'every' command

* Add docummentation for 'every' command

* Check actual filenames in 'every' command tests
2020-06-17 07:58:41 +12:00
Arash Outadi
a042f407c1
1882-Add min, max in addition to average for acting lists (#1969)
* Converting average.rs to math.rs

* Making some progress towards math

Examples and unit tests failing, also think I found a bug with passing in strings

* Fix typos

* Found issue with negative numbers

* Add some comments

* Split commands like in split and str_ but do not register?

* register commands in cli

* Address clippy warnings

* Fix bad examples

* Make the example failure message more helpful

* Replace unwraps

* Use compare_values to avoid coercion issues

* Remove unneeded code
2020-06-14 09:49:57 +12:00
Darren Schroeder
731aa6bbdd
use encoding on open for #1939 (#1949)
* WIP - not compiling

* compiling but panicing

* still broken

* nearly working

* reverted deserializer_string changes
updated enter.rs and open.rs to use Option<Tagged<String>>
Accepted Clippy suggestions
Accepted fmt suggestions
Left original code from open.rs
 We may want to use some of it and only fallback to encoding.

* Don't exit when there is an unknown encoding.

* When encoding is unknown default to utf-8.

* only do encoding if the user says to it

* merged some conflicts on open

* made error messages consistent

* Updated unwrap with expect

* updated open test to pass with more descriptive err
updated enter test to not fail

* change _location to location

* changed _visitor to visitor

* Added a more verbose usage statement for encoding
Linked to docs.rs/encoding_rs for details

Co-authored-by: Darren Schroeder <fdncred@hotmail.com>
2020-06-11 19:37:43 -05:00
Jonathan Turner
982f067d0e
Proper precedence history in math (#1966) 2020-06-12 05:17:08 +12:00
Joseph T. Lyons
bef9669b85
When the nushell is located in a path that has a space in it, these tests break, this fixes it (#1944) 2020-06-07 15:50:52 +12:00
utam0k
15e66ae065
Implement an option to show paths made of mkdir. (#1932) 2020-06-06 15:13:38 -04:00
Rohan Rout
ae72593831
changed to-float to to-decimal (#1926)
* changed to-float to to-decimal

* changed to-float to to-decimal
2020-06-02 09:02:57 +12:00
Andrés N. Robalino
ad43ef08e5 Support average for tables. 2020-05-30 10:33:09 -05:00
Andrés N. Robalino
fe01a223a4 Str plugin promoted to built-in Nu command. 2020-05-28 11:18:58 -05:00
Jason Gedge
0a6692ac44
Simplify parse plugin code. (#1904)
Primarily, instead of building a parse pattern enum, we just build the regex
directly, with the appropriate capture group names so that the column name
codepaths can be shared between simple and `--regex` patterns.

Also removed capture group count compared to column name count. I don't think
this codepath can possibly be reached with the regex we now use for the
simplified capture form.
2020-05-28 09:58:06 -04:00
Jonathan Turner
fa812849b8
Fix warnings and split Scope (#1902) 2020-05-27 16:50:26 +12:00
k-brk
9567c1f564
Fix for inconsistency when quoted strings are used with with_env shorthand (#1900) 2020-05-26 15:03:55 -04:00
Joseph T. Lyons
a915471b38
Cal documentation updates (#1895) 2020-05-26 07:21:36 -04:00
Jason Gedge
cb6ccc3c5a
Improve the simplified parse form. (#1875) 2020-05-25 14:19:49 -04:00
Jason Gedge
005d76cf57
Fix broken ordering of args when parsing command with env vars. (#1841) 2020-05-24 19:26:27 -04:00
Shaarad Dalvi
9c14fb6c02
Show error when trying to sort by invalid column (#1880)
* Show error when trying to sort by invalid column

* Added test for changes

* Addressed comments, updated test

* Removed unnecessary mutable keyword

* Changed split-column to solt column after rebase from upstream
2020-05-25 05:37:08 +12:00
Andrés N. Robalino
edbecda14d Split split command to sub commands. 2020-05-24 02:02:44 -05:00
Alexander James
aadbcf5ce8
Issue 1787 (#1827) 2020-05-23 20:08:39 -04:00
Oleksii Filonenko
9e6ab33fd7
Add --regex flag to parse (#1863) 2020-05-22 10:13:58 -04:00
Joseph T. Lyons
3239e5055c
Added a count column on the histogram command (#1853)
* Adding iniitial draft for the addition of the count column on the histogram command

* Update histogram documentation

* Add count column test to histogram command

* Fix error in histogram documentation
2020-05-20 18:02:36 +12:00
Jonathan Turner
b89976daef
let format access variables also (#1842) 2020-05-19 16:20:09 +12:00
Jason Gedge
6efabef8d3
Remove interpretation of Primitive::Nothing as the number 0. (#1836) 2020-05-18 15:18:46 -04:00
Jason Gedge
acf13a6fcf
Add (near) automatic testing for command examples (#1777) 2020-05-18 08:56:01 -04:00
Jonathan Turner
0abc94f0c6
Bump some of our dependencies (#1809) 2020-05-17 10:34:10 +12:00
Jonathan Turner
076fde16dd
Evaluation of command arguments (#1801)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Finish adding the baseline refactors for argument invocation

* Finish cleanup and add test

* Add missing plugin references
2020-05-16 15:18:24 +12:00
Hoàng Đức Hiếu
e3b7e47515
cal: fix thursday typo (#1776) 2020-05-13 08:06:31 -04:00
Jason Gedge
75edcbc0d0
Simplify mv in FilesystemShell (#1587) 2020-05-12 16:40:45 -04:00
Jonathan Turner
c3535b5c67
It-expansion fixes (#1757)
* It-expansion fixes

* fix clippy
2020-05-12 15:58:16 +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
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
Jonathan Turner
c06a692709
Bash-like shorthand with-env (#1718)
* Bash-like shorthand with-env

* fix clippy warning
2020-05-06 18:57:37 +12:00
Jonathan Turner
b37e420c7c
Add with-env command (#1717) 2020-05-06 15:56:31 +12:00
Jonathan Turner
a9968046ed
Add subcommands. Switch from-* and to-* to them (#1708) 2020-05-04 20:44:33 +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
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