Commit Graph

511 Commits

Author SHA1 Message Date
Dillen Meijboom
11ea5e61fc
Fix out of bounds in header command when row size is different (#2437)
* Use header vec to loop over the row instead of the row itself to fix out of bounds

* Fixed formatting
2020-08-29 06:32:08 +12:00
Jason Gedge
728852c750
Remove unnecessary reference to ichwh in command completer (#2435) 2020-08-27 10:14:04 -04:00
Andrés N. Robalino
26cec83b63 Extract out history parts. 2020-08-27 06:28:18 -05:00
Andrés N. Robalino
4724b3c570 Slim down cli plugin logic. 2020-08-27 06:28:18 -05:00
Gurpreet Singh
303a9defd3
Added math product support (#2249)
* added math product: working initial impl

* resolving merge conflicts

* impl std::ops::Mul for Filesize

* rebased with main; refactored product implementation

* fixed error msg, added docs for math product
2020-08-27 17:58:01 +12:00
Bailey Layzer
a64270829e
Move alias type inference (experimental) behind --infer/-i flag (#2418)
* put alias type inference behind --infer/-i flag

* revert cargo.lock
2020-08-27 17:48:13 +12:00
Darren Schroeder
8f5df89a78
added -e --end to search from the end of the string for the pattern (#2430)
* added -e --end to search from the end of the string for the pattern

* tests
2020-08-27 17:46:45 +12:00
Amit Dev
39f402c8cc
Add configuration option to disable hinter (#2403) (#2405)
* Add configuration option to disable hinter

* Move hint configuration inside line_editor
2020-08-27 17:45:55 +12:00
utam0k
7702d683c7
Allow the calculation of bytes and int. (#2160)
* Allow the calculation of bytes and int.

* fix clippy.

* minimal implement the into_into command.

* Revert "fix clippy."

This reverts commit 0d7cf72ed2.

* Revert "Allow the calculation of bytes and int."

This reverts commit 9c4e3787f5.

* set the argument to any type.

* if the argument is an int, return it with no change in value.

* add tests for into-int command.

* fix a faild test.
2020-08-27 17:44:18 +12:00
Darren Schroeder
766533aafb
Path dirname and filestem (#2428)
* add dirname and filestem to path commands

* hacked around with gedge's help to get it to compile with cargo b

* fmt
2020-08-26 14:47:23 -05:00
Darren Schroeder
6e3a827e32
plugin changes to support script plugins (#2315)
* plugin changes to support script plugins
* all platforms can have plugins with file extensions
* added .cmd, .py, .ps1 for windows
* added more trace! statements to document request and response

* WIP

* pretty much working, need to figure out sink plugins

* added a home for scripting plugin examples, ran fmt

* Had a visit with my good friend Clippy. We're on speaking terms again.

* add viable plugin extensions

* clippy

* update to load plugins without extension in *nix/mac.

* fmt
2020-08-26 13:45:11 -05:00
Andrés N. Robalino
6685f74e03 Command especific configuration extraction baseline. 2020-08-26 10:33:55 -05:00
Andrés N. Robalino
034c33c2b5 Allow invocations and fix span error reporting. 2020-08-26 06:46:14 -05:00
Jörn Zaefferer
08d1be79fc
Add some cross-references to usage texts (#2417) 2020-08-26 09:43:41 +12:00
Andrés N. Robalino
a64cfb6285 Command expression need not carry span information. 2020-08-24 22:48:33 -05:00
Jonathan Turner
f078aacc25
Improve the error message if alias type inference fails (#2399)
* Improve the error message if alias type inference fails

* Improve error further
2020-08-25 06:38:24 +12:00
Jonathan Turner
d859bff877
Sort subcommands in the help text (#2396) 2020-08-24 08:35:16 +12:00
Jonathan Turner
48850becd8
Add some minor fixes (#2391) 2020-08-22 17:06:19 +12:00
gorogoroumaru
2ea42f296c
Date subcommands (#2383)
* refactored date command

* format files
2020-08-22 15:46:48 +12:00
Jason Gedge
eb2ba470c7
Have lite-parse complete return a complete bare form. (#2389)
Previously, lite parse would stack up opening delimiters in vec, and if we
didn't close everything off, it would simply return an error with a partial form
that didn't include the missing closing delimiters. This commits adds those
delimiters so that `classify_block` can parse correctly.
2020-08-22 15:43:40 +12:00
Shaurya
a951edd0d5
Fix the version command to include the commit hash (#2390)
* Fix the version command to include the commit hash when it is _not_ empty

* Format code
2020-08-22 15:21:59 +12:00
Matt Clarke
d65a38dd41
ls .file and ls **/.* show hidden files (#2379) 2020-08-21 21:49:34 -04:00
Jason Gedge
8f568f4fc5
Support completions for a single hyphen argument. (#2388)
The parser sees this as a positional argument, but when requesting completions
this could be either a filename that starts with a hyphen, or it could be a
flag. This expands the completion engine's interface to return a vec of possible
completion locations instead of an optional one, because we want to show all
possibilities instead of assuming one or the either.
2020-08-21 21:26:47 -04:00
Jörn Zaefferer
ee26590011
touch: support multiple arguments (#2386)
Fixes #2384
2020-08-22 12:08:30 +12:00
Jason Gedge
11352f87f0
Remove rustyline context from nu's completion context (#2387) 2020-08-21 18:21:14 -04:00
Jason Gedge
9f85b10fcb
Add method to convert ClassifiedBlock into completion locations. (#2316)
The completion engine maps completion locations to spans on a line, which
indicate whther to complete a command name, flag name, argument, and so on.

Initial implementation is simplistic, with some rough edges, since it relies
heavily on the parser's interpretation. For example

    du -

if asking for completions, `-` is considered a positional argument by the
parser, but the user is likely looking for a flag. These scenarios will be
addressed in a series of progressive enhancements to the engine.
2020-08-21 15:37:51 -04:00
Leonhard Kipp
0dd1403a69
Sleep command (#2381)
* Add deserialization of Primitive::Duration; Fixes #2373

* Implement Sleep command

* Add comment saying you should name your rest field "rest"

* Fix typo

* Add documentation for sleep command
2020-08-22 05:51:29 +12:00
Bailey Layzer
ad395944ef
SyntaxShape checking in Alias (#2377)
* initial, working for shallow internals

* add recurion on Block

* clean up/abstract, Invocations

* use Result

* inspection of Binary, tests

* improve code structure

* move arg shape inspection to Alias command

* add spanned errors, tests, cleanup for PR

* fix test, clippy
2020-08-20 15:18:55 +12:00
Joseph T. Lyons
6126209f57
Fix column count to not break on empty tables (#2374) 2020-08-18 22:16:35 -04:00
Jonathan Turner
43e061f8c6
Add wasm sample for CI (#2372)
* Add wasm sample for CI

* Add wasm sample for CI

* Add wasm sample for CI
2020-08-19 07:34:05 +12:00
Jonathan Turner
738541f727
Move nu-data out of nu-cli (#2369)
* WIP for moving nu-data out

* Refactor nu-data out of nu-cli

* Remove unwraps

* Remove unwraps
2020-08-18 19:00:02 +12:00
Luccas Mateus
1d5518a214
Err message for sort-by invalid types now shows the mismatched types (#2366)
* 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
2020-08-18 17:37:45 +12:00
Sam Hedin
57101d5022
Run exitscripts in original dir (#2352)
* Modify testcase

* Run exitscript in the folder it was specified

* Update documentation

* Add comment

* Borrow instead of clone

* Does this just... work on windows?

* fmt

* as_str

* Collapse if by order of clippy

* Support windows

* fmt

* refactor tests

* fmt

* This time it will work on windows FOR SURE

* Remove debug prints

* Comment

* Refactor tests

* fmt

* fix spelling

* update comment
2020-08-18 17:36:09 +12:00
Rick Richardson
f6ff6ab6e4
added various case conversion commands for str. Added the inflection … (#2363)
* added various case conversion commands for str. Added the inflection crate as a dependency

* lighten the restriction on the inflector dependency

* publishing the case commands

* fix typo

* fix kebab case test

* formatting
2020-08-18 08:18:23 +12:00
Luccas Mateus
a224cd38ab
Solving the issue "sort-by should fail gracefully if mismatched types are compared" (#2360) 2020-08-17 14:57:29 -04:00
Darren Schroeder
e292bb46bb
added the other table "themes" so that they could be used via config (#2365) 2020-08-17 11:20:00 -05:00
Andrés N. Robalino
05aca1c157 Config refactoring baseline.
The initial configuration refactoring already gave significant benefits
with my use case. On another note, Commands should know and ask for
configuration variables. We could, as we refactor, add the ability
for commands to tell what configuration variables knows about and
their types.

This way, completers can be used too when using `config` command if we
also add a sub command that config could set variables to.

Commands stating the config variables they know about will allow us
to implement it in `help` and display them.
2020-08-17 04:49:33 -05:00
Jonathan Turner
8d269f62dd
Pass metadata in 'to json' (#2359) 2020-08-16 15:47:00 +12:00
Joseph T. Lyons
b1a946f0dc
Add test file for count command (#2358)
* Add test file for count command

* rustfmt + Clippy
2020-08-16 15:16:49 +12:00
Matt Clarke
c59f860b48
Renamed time units (#2356)
* Changed time units as outlined in issue #2353.
Also applied changes to to_str for Unit - not sure if that was what was wanted.

* Forgot the tests!

* Updated primitive.rs to match changes.

* Updated where example to match changes.

* And the html test!
2020-08-16 07:03:28 +12:00
Joseph T Lyons
c6588c661a Add column flag to count command 2020-08-15 07:52:59 -05:00
Joseph T Lyons
d1d98a897a Fix "occurrences" typo in histrogram test file 2020-08-15 07:51:12 -05:00
Joseph T Lyons
3dc95ef765 Fix typo in "occurrences" 2020-08-15 07:51:12 -05:00
Jonathan Turner
da4d24d082
Bump to 0.18.2. Move starship external. (#2345)
* Bump to 0.18.2. Move starship external.

* Fix failing test
2020-08-14 07:02:45 +12:00
Shaurya Shubham
22519c9083
Only have commit hash in version if git doesn't error (#2336)
* Add commit to version command

* Replace unwrap with expect.

* Only have commit hash if git doesn't error

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-08-13 06:51:12 +12:00
Joseph T. Lyons
1601aa2f49
Remove with-symlink-targets flag from ls (#2334)
* Remove `with-symlink-targets` flag from `ls`

* Fix test to use `ls -l` to output all the columns of `ls`

* Fix error message

* Delete test that originally covered `ls -w`
2020-08-13 05:21:19 +12:00
Andrés N. Robalino
015d2ee050 Lint [result|option]_unwrap_used as been renamed to clippy::unwrap_used 2020-08-12 09:34:16 -05:00
Andrés N. Robalino
dd7ee1808a histogram: rename 'count' column to 'ocurrences' 2020-08-12 09:34:16 -05:00
Andrés N. Robalino
0db4180cea histogram: optionally use a valuator for histogram value. 2020-08-12 09:34:16 -05:00
Andrés N. Robalino
8ff15c46c1
histogram gives back percentage column. (#2340) 2020-08-12 04:21:28 -05:00
Andrés N. Robalino
48cfc9b598
apply all the block run's stream. (#2339) 2020-08-12 02:51:24 -05:00
Jonathan Turner
87d71604ad
Bump to 0.18.1 (#2335) 2020-08-12 15:59:28 +12:00
Andrés N. Robalino
e372e7c448
Display built features. Long/Short commit hashes display removed due to cargo publishing. (#2333)
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-08-12 15:13:33 +12:00
Darren Schroeder
0194dee3a6
Updated version hashing and bumped nu-cli to 0.18.1 (#2331)
* Updated version hashing and bumped nu-cli to 0.18.1

* made code pertyer

* Update version.rs

* Update version.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-08-12 09:43:23 +12:00
Sam Hedin
3c18169f63
Autoenv fix: Exitscripts incorrectly running when visiting a subdirectory (#2326)
* Add test case for issue

* Preliminary fix

* fmt

* Reorder asserts

* move insertion

* Touch nu-env.toml

* Cleanup

* touch nu-env toml

* Remove touch

* Change feature flags
2020-08-12 07:54:49 +12:00
Darren Schroeder
43e9c89125
moved theme assets local to crate (#2329)
* moved theme assets local to crate

* remove the TODO comment
2020-08-11 13:57:03 -05:00
Jonathan Turner
2ad07912d9
Bump to 0.18 (#2325) 2020-08-11 18:44:53 +12:00
Corvus Corax
9264325e57
Make history file location configurable (#2320)
* Make history location configurable

Add history-path to your config if you want an alternate history file
location

* use IndexMap.get() instead of index

Co-authored-by: Amanita Muscaria <nope>
2020-08-11 13:58:53 +12:00
Darren Schroeder
901157341b
Bumped which-rs to 4.0.2 (#2321)
This should fix #1541
2020-08-11 13:55:43 +12:00
Darren Schroeder
f0dbffd761
Add 228 json html themes for to html (#2308)
* add 228 json html themes
removed old assets, added new zipped asset
added --list to get a list of the theme names
reworked some older theme code
added rust-embed and zip crate
removed the dark tests

* fmt

* Updated, removed excess comments
Changed usage a bit
Updated the error handling
Added some helper items in --list
2020-08-11 05:43:16 +12:00
Rajasekharan Vengalil
f14c0df582
Allow disabling welcome message on launch (#2314)
* Implements #2313
2020-08-09 11:38:21 +12:00
Shaurya Shubham
362bb1bea3
Add commit hash to version command (#2312)
* Add commit to version command

* Replace unwrap with expect.
2020-08-08 17:39:34 +12:00
Andrés N. Robalino
724b177c97
Sample variance and Sample standard deviation. (#2310) 2020-08-06 23:56:19 -05:00
Jonathan Turner
50343f2d6a
Add stderr back when using do -i (#2309)
* Add stderr back when using do -i

* Add stderr back when using do -i
2020-08-07 16:53:37 +12:00
Darren Schroeder
3122525b96
removed rustyline config duplication (#2306)
* removed rustyline config duplication
set other rustyline defaults if line_editor section doesn't exist
updated keyseq_timeout to -1 if emacs mode is chosen

* change checking rustyline config to if lets

* removed some unneccessary code
2020-08-05 16:34:28 -05:00
Darren Schroeder
8232c6f185
Update rustyline defaults (#2305)
Use rustyline defaults if no config exists for line_editor (for most options)
2020-08-05 13:05:13 -05:00
Nico Mandery
6202705eb6
parse most common date formats using dtparse crate (#2303)
* use dtparse crate to parse most common date formats

* use dtparse crate to parse most common date formats - cargo fmt
2020-08-05 12:44:52 +12:00
Bailey Layzer
e1c5940b04
Add command "reduce" (#2292)
* initial

* fold working

* tests and cleanup

* change command to reduce, with fold flag

* move complex example to tests

* add --numbered flag
2020-08-05 05:16:19 +12:00
Andrés N. Robalino
7f35bfc005
histogram: support regular values. (#2300) 2020-08-04 04:57:25 -05:00
k-brk
c48c092125
String funcs - Contains and IndexOf (#2298)
* Contains and index of string functions

* Clippy and fmt
2020-08-04 18:36:51 +12:00
Andrés N. Robalino
028fc9b9cd
Data summarize reporting overhaul. (#2299)
Refactored out most of internal work for summarizing data opening
the door for generating charts from it. A model is introduced
to hold information needed for a summary, Histogram command is
an example of a partial usage. This is the beginning.

Removed implicit arithmetic traits on Value and Primitive to avoid
mixed types panics. The std operations traits can't fail and we
can't guarantee that. We can handle gracefully now since compute_values
was introduced after the parser changes four months ago. The handling
logic should be taken care of either explicitly or in compute_values.

The zero identity trait was also removed (and implementing this forced
us to also implement Add, Mult, etc)

Also: the `math` operations now remove in the output if a given column is not computable:

```
> ls | math sum
──────┬──────────
 size │ 150.9 KB
──────┴──────────
```
2020-08-03 17:47:19 -05:00
Joseph T. Lyons
eeb9b4edcb
Match cleanup (#2294)
* Delete unnecessary match

* Use `unwrap_or_else()`

* Whitespace was trim on file save

* Use `map_or_else()`

* Use a default to group all match arms with same output

* Clippy made me do it
2020-08-04 05:43:27 +12:00
Kornel
3a7869b422
Switch to maintained app_dirs (#2293)
* Switch to maintained app_dirs

* Update app_dirs under old name
2020-08-04 05:41:57 +12:00
Joseph T. Lyons
c48ea46c4f
Match cleanup (#2290) 2020-08-02 18:34:33 -04:00
Jonathan Turner
f33da33626
Add --partial to 'to html' (#2291) 2020-08-03 08:47:54 +12:00
Shaurya Shubham
a88f5c7ae7
Make str collect take an optional separator value (#2289)
* Make `str collect` take an optional separator value

* Make `str collect` take an optional separator value

* Add some tests

* Fix my tests
2020-08-02 19:29:29 +12:00
Joseph T. Lyons
ee734873ba
Fix no longer working histogram example (#2271)
* Fix no longer working histogram example

* Oops
2020-08-02 06:38:45 +12:00
Joseph T. Lyons
9fb6f5cd09
Change f/full flag to l/long for ls and ps commands (#2283)
* Change `f`/`full` flag to `l`/`long` for `ls` and `ps` commands

* Fix a few more `--full` instances
2020-08-02 06:30:45 +12:00
Jonathan Turner
ba81278ffd
Remove build.rs and nu-build (#2282) 2020-08-01 09:21:10 +12:00
Darren Schroeder
10fbed3808
updated cmd builtin commands (#2266)
* updated cmd builtin commands

* removed cd, chdir, exit, prompt, rem

* remove more commands, what remains is useful

* cargo fmt is so finicky
2020-07-31 09:51:42 +12:00
Darren Schroeder
16cfc36aec
set default edit_mode to emacs instead of vi (#2278) 2020-07-30 14:59:20 -05:00
Warren Seine
aca7f71737
🐛 Fix path command error messages (#2261). (#2276) 2020-07-31 06:51:14 +12:00
Shaurya Shubham
3282a509a9
Make insert take in a block (#2265)
* Make insert take in a block

* Add some tests
2020-07-30 16:58:54 +12:00
Shaurya Shubham
878b748a41
Add list output for to html (#2273) 2020-07-30 16:54:55 +12:00
k-brk
18a4505b9b
starts_with ends_with match functions for string (#2269) 2020-07-30 16:51:20 +12:00
Matt Hall
26e77a4b05
Add url commands (#2274)
* scheme
* path
* query
* host
2020-07-30 08:56:56 +12:00
Matt Hall
37f10cf273
Add two further path cmds - type and exists (#2264)
* Add two further path cmds - type and exists

* Update type.rs

Try a more universal directory

* Update type.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-07-27 14:12:07 +12:00
k-brk
5e0a9aecaa
ltrim and rtrim for string (#2262)
* Trim string from left and right

* Move trim to folder

* fmt

* Clippy
2020-07-27 06:09:35 +12:00
Matt Hall
7e2c627044
WIP: Path utility commands (#2255)
* Add new path commands

basename, expand and extension. Currently there is no real error
handling. expand returns the initial path if it didn't work, the others
return empty string

* Optionally apply to path
2020-07-26 07:29:15 +12:00
Jörn Zaefferer
e66a8258ec
add example to parse command, with row output (#2256) 2020-07-26 06:14:29 +12:00
Jason Gedge
e4b42b54ad
Simplify NuCompleter. (#2254)
- Removing old code for dealing with escaping, since that has moved elsewhere.
- Eliminating some match statements in favour of result/option methods.
- Fix an issue where completing inside quotes could remove the quote at the
  beginning, if one already existed on the line but the replacement didn't have
  a quote at the beginning.
2020-07-25 10:41:14 -04:00
Joseph T. Lyons
de18b9ca2c
Match cleanup (#2248) 2020-07-25 08:40:35 -04:00
Jason Gedge
6b31a006b8
Refactor all completion logic into NuCompleter (#2252)
* Refactor all completion logic into `NuCompleter`

This is the next step to improving completions. Previously, completion logic was
scattered about (`FilesystemShell`, `NuCompleter`, `Helper`, and `ShellManager`).
By unifying the core logic into a central location, it will be easier to take the
next steps in improving completion.

* Update context.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-07-25 11:39:12 +12:00
Jason Gedge
2db4fe83d8
Remove unnecessary peekable iterator (#2251) 2020-07-24 12:06:12 -04:00
Warren Seine
55a2f284d9
Add to xml command (#2141) (#2155) 2020-07-24 19:41:22 +12:00
Jason Gedge
2d3b1e090a
Remove piping of stderr. (#2247)
In any other shell, stderr is inherited like normal, and only piped if you
request it explicitly (e.g., `2>/dev/null`). In the case of a command like
`fzf`, stderr is used for the interactive selection of files. By piping it,
something like

    fzf | xargs echo

does not work. By removing all stderr piping we eliminate this issue. We can
return later with a way to deal with stderr piping when an actual use case
arises.
2020-07-24 17:56:50 +12:00
Darren Schroeder
ed0c1038e3
Step 1 for to html theme-ing (#2245)
* reworked theming step 1.
added theme parameter.
hard coded 4 themes

* forgot about blulocolight

* aarrrrg! test are in another place. fixed i think.
2020-07-23 13:21:58 -05:00
Darren Schroeder
e71f44d26f
if config file doesn't exist, set defaults. (#2244)
if line_editor in config doesn't exist, set defaults.
2020-07-23 08:27:45 -05:00
Darren Schroeder
e3d7e46855
added defaults. fixed but of not loading history. (#2243) 2020-07-23 07:19:05 -05:00
Darren Schroeder
7e9f87c57f
Expose all rustyline configuration points (#2238)
* Added all rustyline config points

* comments cleanup

* my good friend fmt keeps changing his mind
2020-07-23 09:43:52 +12:00