Commit Graph

654 Commits

Author SHA1 Message Date
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
morrme
5d17b72852
update config documentation (#2178)
* update config documentation

* update config syntax

* update config syntax

* Update alias.md

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-07-23 09:42:04 +12:00
k-brk
6b4634b293
Convert table of primitives to positional arguments for external cmd (#2232)
* Convert table of primitives to positional arguments for external cmd

* Multiple file test, fix for cococo
2020-07-23 09:41:34 +12:00
Jonathan Turner
2a084fc838
Bump to 0.17.0 (#2237) 2020-07-22 06:41:49 +12:00
Joseph T. Lyons
a36d2a1586
Revert "hopefully the final fix for history (#2222)" (#2235)
This reverts commit 6829ad7a30.
2020-07-21 18:19:04 +12:00
Darren Schroeder
aaed9c4e8a
added ansi example (#2230)
* added ansi example

* added strcollect to example
2020-07-20 18:33:39 -05:00
Darren Schroeder
b9278bdfe1
Char example (#2231)
* added ansi example

* added another example

* changed example

* ansi changes here by mistake
2020-07-20 14:25:38 -05:00
Joseph T. Lyons
6eb2c94209
Add flag for case-insensitive sort-by (#2225)
* Add flag for case-insensitive sort-by

* Fix test names

* Fix documentation comments
2020-07-21 05:31:58 +12:00
Darren Schroeder
7b1a15b223
Campbell colors (#2219)
* added campbell theme to html colors

* updated test results. had to make change for ci.

* hopefully the last changes for this stupid test :)

* moved tests to html.rs

* remove unnecessary using statement.

* still fighting with tests and tests are winning.
2020-07-20 07:57:29 -05:00
Pierre-André Gagnon
aad3cca793
Add benchmark command (#2223) 2020-07-20 05:39:43 +12:00
Darren Schroeder
6829ad7a30
hopefully the final fix for history (#2222) 2020-07-19 07:47:55 -05:00
Jonathan Turner
c65acc174d
Add hex pretty print to 'to html' (#2221) 2020-07-19 16:44:15 +12:00
Jonathan Turner
2dea392e40
Add hex pretty print to 'to html' (#2217) 2020-07-19 12:14:40 +12:00
Jonathan Turner
0c43a4d04b
Add hex pretty print to 'to html' (#2216) 2020-07-19 10:12:17 +12:00
Jonathan Turner
ebc2d40875
Expose more registry APIs (#2215) 2020-07-19 06:01:05 +12:00
k-brk
3432078e77
Fix uniq to work with simple values (#2214) 2020-07-19 05:19:03 +12:00
Joseph T. Lyons
9e5170b3dc
Clean up lines command (#2207) 2020-07-19 05:17:56 +12:00
Y.Horie
0ae7c5d836
Fix if description (#2204) (#2213) 2020-07-19 05:16:35 +12:00
Darren Schroeder
d0712a00f4
made it easier to change colors (#2212)
* made it easier to change colors
and the beginning of html theming

* fmt
2020-07-18 11:05:45 -05:00
Jonathan Turner
5e722181cb
Export more defs from nu-cli (#2205) 2020-07-18 16:47:03 +12:00
Shaurya Shubham
ffe3e2c16b
Rename calc to math eval and allow it to optionally take an expression as an argument (#2195)
* Rename `calc` to `math eval` and allow it to optionally take the expression as an argument

* Moved calc tests to math eval
Also added 2 tests and changed 1 test

* Move calc docs to math eval
2020-07-18 16:11:19 +12:00
Darren Schroeder
04e8aa31fe
update history max size with two different calls. (#2202)
Closes #2193
2020-07-18 15:26:32 +12:00
Jason Gedge
9d24b440bb
Introduce completion abstractions to nushell. (#2198)
* Introduce completion abstractions to nushell.

Currently, we rely on rustyline's completion structures. By abstracting this
away, we are more flexible to introduce someone elses completion engine, or our
own.

* Update value_shell.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-07-18 14:55:10 +12:00
Jonathan Turner
d8594a62c2
Add wasm support (#2199)
* Working towards a PoC for wasm

* Move bson and sqlite to plugins

* proof of concept now working

* tests are green

* Add CI test for --no-default-features

* Fix some tests

* Fix clippy and windows build

* More fixes

* Fix the windows build

* Fix the windows test
2020-07-18 13:59:23 +12:00
Joseph T. Lyons
dbe0effd67
User error propagation operator (#2201) 2020-07-18 13:12:06 +12:00
Arash Outadi
b358804904
Auto-Generate Documentation for nushell.com (#2139)
* Very rough idea

* Remove colour codes

* Work on command for generating docs

* Quick comment

* Use nested collapsible markdown

* Refine documentation command

* Clippy and rename docs

* This layout probably seems best

Also moved some code to documentation.rs to avoid making help.rs massive

* Delete summaries.md

* Add usage strings

* Remove static annotations

* get_documentation produces value

Which will be used like
'help generate_docs | save "something"'
The resulting yaml can be passed to a script for generating HTML/MD files in the website

* Fix subcommands

* DRY code

* Address clippy:

* Fix links

* Clippy lints

* Move documentation to more central location
2020-07-18 10:22:43 +12:00
Darren Schroeder
7b02604e6d
changed colors as per Jörn's suggestion. (#2200)
* changed colors as per Jörn's suggestion.

* cleaned up old comments
2020-07-17 15:02:54 -05:00
k-brk
6497421615
Keep until and while as subcommands of keep (#2197) 2020-07-18 07:06:48 +12:00
Joseph T. Lyons
f26151e36d
Silence Rust 1.45 Clippy warnings (#2196)
* Silence Rust 1.45 Clippy warnings dealing with using `map_err()`

* Silence false Clippy warning

* Fix last Clippy error for unnecessary conversion

* Fix `and_then` clippy warnings
2020-07-18 05:57:15 +12:00
Joseph T. Lyons
0f688d7da7
Use '?' for error propagation, remove match (#2194) 2020-07-17 05:39:51 +12:00
Darren Schroeder
a04dfca63a
added ability to supply --dark_bg to to html (#2189)
* added ability to supply --dark_bg to to html

* fmt + fixed tests

* updated other html tests

* fmt
2020-07-16 08:19:29 -05:00
Jonathan Turner
72f6513d2a
Keybindings and invocation fix (#2186) 2020-07-15 19:51:59 +12:00
Joseph T. Lyons
7c0a830d84
Match cleanup (#2184)
* Use `unwrap_or()` to remove `match`

* Use `?` for error propogation, and remove `match`
2020-07-15 19:51:41 +12:00
George Pollard
42a1adf2e9
Indices are (now) green, bold, right-aligned (#2181)
With https://github.com/nushell/nushell/pull/355 the (numeric) index column of tables was changed to be right-aligned. After the move to `nu-table` the index column is now centered instead of right-aligned. I think this is a copy-paste bug where [this line](71e55541d7/crates/nu-cli/src/commands/table.rs (L190)) has been copied from [this line](71e55541d7/crates/nu-cli/src/commands/table.rs (L207)), since the code is out-of-sync with the comment. This change restores harmony between the description and the function of the code.
2020-07-15 15:48:20 +12:00
Andrés N. Robalino
b4761f9d8a
Remove commands meant for internal use. (#2182) 2020-07-14 21:49:46 -05:00
Andrés N. Robalino
71e55541d7
Merge skip command varieties into one command with sub commands. (#2179) 2020-07-14 20:44:49 -05:00
Joseph T. Lyons
5f1075544c
Remove unnecessary match statement (#2177) 2020-07-14 20:17:28 -04:00
Joseph T. Lyons
0934410b38
Use matches!() for true/false returning match statements (#2176) 2020-07-14 20:11:41 -04:00
Joseph T. Lyons
17e6c53b62
Add str reverse subcommand (#2170)
* Add str reverse subcommand

* rustfmt
2020-07-15 08:47:04 +12:00
Sam Hedin
80d2a7ee7a
Fix autoenv executing scripts multiple times (#2171)
* Fix autoenv executing scripts multiple times

Previously, if the user had only specified entry or exitscripts the scripts
would execute many times. This should be fixed now

* Add tests

* Run exitscripts

* More tests and fixes to existing tests

* Test solution with visited dirs

* Track visited directories

* Comments and fmt
2020-07-15 07:16:50 +12:00
Ali Mousa
8fd22b61be
Add variance and stddev subcommands to math command (#2154)
* add variance (population)
subcommand to math

* impl variance subcommand with spanning errors for invalid types

* add stddev subcommand to math

* rename bytes to filesize

* clippy fix -- use expect instead of unwrap in variance tests
2020-07-15 07:15:02 +12:00
Andrés N. Robalino
e9313a61af
Make str more strict. (#2173) 2020-07-14 10:04:00 -05:00
Andrés N. Robalino
f2c4d22739
group-by can generate custom grouping key by block evaluation. (#2172) 2020-07-14 08:45:19 -05:00
Jason Gedge
8551e06d9e
Ensure source buffer is cleared after reading in MaybeTextCodec. (#2168) 2020-07-14 11:24:52 +12:00
Jonathan Turner
07594222c0
Extend 'Shell' with open and save capabilities (#2165)
* Extend 'Shell' with open and save capabilities

* clippy fix
2020-07-13 21:07:44 +12:00
Sam Hedin
78f13407e6
Documentation for autoenv (#2163)
* Documentation

* Somewhat nicer?

* cat
2020-07-13 18:23:19 +12:00
bailey-layzer
5a34744d8c
add --char flag to 'str trim' (#2162) 2020-07-13 17:45:34 +12:00
Darren Schroeder
0456f4a007
To html with color (#2158)
* adding color to html output

* latest changes

* seems to be working now

* WIP - close. Good is the enemy of Great.

* fixed the final issues... hopefully
2020-07-13 17:40:59 +12:00
Sam Hedin
f3f40df4dd
Tests for autoenv (and fixes for bugs the tests found) (#2148)
* add test basic_autoenv_vars_are_added

* Tests

* Entry and exit scripts

* Recursive set and overwrite

* Make sure that overwritten vals are restored

* Move tests to autoenv

* Move tests out of cli crate

* Tests help, apparently. Windows has issues

On windows, .nu-env is not applied immediately after running autoenv trust.
You have to cd out of the directory for it to work.

* Sort paths non-lexicographically

* Sibling dir test

* Revert "Sort paths non-lexicographically"

This reverts commit 72e4b856af.

* Rename test

* Change conditions

* Revert "Revert "Sort paths non-lexicographically""

This reverts commit 71606bc62f.

* Set vars as they are discovered

This means that if a parent directory is untrusted,
the variables in its child directories are still set properly.

* format

* Fix cleanup issues too

* Run commands in their separate functions

* Make everything into one large function like all the cool kids

* Refactoring

* fmt

* Debugging windows path issue

* Canonicalize

* Trim whitespace

* On windows, use echo nul instead of touch to create file in test

* Avoid cloning by using drain()
2020-07-12 16:14:09 +12:00
bailey-layzer
bdef5d7d72
Add 'str from' subcommand (#2125)
* add human, precision commands

* add 'str from' subcommand (converted from human/precision commands)

move human tests to str from

* add default locale, platform-specific SystemLocale use

* fix platform specific num-format dependency, remove invalid test

* change 'str from' localization to static num_format::Locale::en

* minor cleanup, nudge ci

* re-attempt ci
2020-07-12 15:57:39 +12:00
Jonathan Turner
3ec0242960
fix the name of 'do' (#2152)
* fix the name of 'do'

* try to fix ci
2020-07-11 17:09:05 +12:00
Jonathan Turner
0bc2e29f99
Rename 'bytes' to 'filesize' (#2153) 2020-07-11 14:17:37 +12:00
Jonathan Turner
1bb6a2d9ed
Split key/value in 'config set' (#2151) 2020-07-11 13:15:51 +12:00
Ritoban Roy-Chowdhury
e848fc0bbe
Updates config to use subcommands (#2146)
* First commit updating `config` to use subcommands (#2119)
    - Implemented `get` subcommand

* Implmented `config set` as a subcommand.

* Implemented `config set_into` as subcommand

* Fixed base `config` command
 - Instead of outputting help, it now outputs the list of all
 configuration parameters.

* Added `config clear` subcommand

* Added `config load` and `config remove` subcommands

* Added `config path` subcommand

* fixed clippy
2020-07-11 12:11:04 +12:00
Jonathan Turner
6820d70e7d
make duration pretty print clearer (#2150)
* make duration pretty print clearer

* fix typo and tests

* fix typo and tests
2020-07-11 09:06:52 +12:00
Joseph T. Lyons
f32ab696d3
Return iter from sort by (#2149) 2020-07-11 06:49:55 +12:00
Pierre-André Gagnon
e07a9e4ee7
1747 add ns to duration (#2128)
* Added nanos to Duration

* Removed unwraps

* Added nanos to Duration

* Removed unwraps

* Fixed errors

* Removed unwraps

* Changed serialization to String

* Fixed Date and Duration comparison
2020-07-11 05:48:11 +12:00
Arash Outadi
6a89b1b010
Remove duplicate method (retag) (#2147) 2020-07-10 06:21:13 -04:00
Joseph T. Lyons
b1b93931cb
Return an iter from last command (#2143) 2020-07-09 09:07:51 -04:00
Joseph T. Lyons
1e62a8fb6e
Fix variable name (#2142) 2020-07-08 19:55:01 -04:00
Joseph T. Lyons
b004236927
Return iter from from vcf (#2137) 2020-07-08 09:20:57 -04:00
Andrés N. Robalino
0fdb9ac5e2
str substring additions. (#2140) 2020-07-08 04:45:45 -05:00
Aleš Katona
28be39494c
add requoting for completions (#2129) 2020-07-07 17:13:39 -04:00
Darren Schroeder
32f18536e1
Add space to special prompt chars (#2122)
So spaces don't have to be escaped with quotes in the config.toml
2020-07-06 10:30:47 -05:00
Andrés N. Robalino
34e1e6e426
Add "move column" command. (#2123) 2020-07-06 10:27:01 -05:00
Jonathan Turner
c3ba1e476f
Make every stream-able (#2120)
* Make every stream-able

* Make each over ranges stream-able
2020-07-06 20:23:27 +12:00
Joseph T. Lyons
a1a0710ee6
Return iter from every command (#2118)
* Return iter from `every` command

* Clippy

* Better variable name
2020-07-06 14:25:39 +12:00
Jonathan Turner
d30c40b40e
Bump to 0.16.1 (#2116) 2020-07-06 08:12:44 +12:00
Joseph T. Lyons
85d848dd7d
Stream results of drop command (#2114)
* Stream results of drop command

* When the amount of rows to drop is equal to or greaten than the size of the table, output nothing
2020-07-06 05:46:06 +12:00
Arash Outadi
74717582ac
Slightly nicer "rm" message (#2113)
* maybe this was root issue

* quotes

* formatting
2020-07-06 05:42:37 +12:00
Sam Hedin
ee18f16378
Autoenv rewrite, security and scripting (#2083)
* Add args in .nurc file to environment

* Working dummy version

* Add add_nurc to sync_env command

* Parse .nurc file

* Delete env vars after leaving directory

* Removing vals not working, strangely

* Refactoring, add comment

* Debugging

* Debug by logging to file

* Add and remove env var behavior appears correct

However, it does not use existing code that well.

* Move work to cli.rs

* Parse config directories

* I am in a state of distress

* Rename .nurc to .nu

* Some notes for me

* Refactoring

* Removing vars works, but not done in a very nice fashion

* Refactor env_vars_to_delete

* Refactor env_vars_to_add()

* Move directory environment code to separate file

* Refactor from_config

* Restore env values

* Working?

* Working?

* Update comments and change var name

* Formatting

* Remove vars after leaving dir

* Remove notes I made

* Rename config function

* Clippy

* Cleanup and handle errors

* cargo fmt

* Better error messages, remove last (?) unwrap

* FORMAT PLZ

* Rename whitelisted_directories to allowed_directories

* Add comment to clarify how overwritten values are restored.

* Change list of allowed dirs to indexmap

* Rewrite starting

* rewrite everything

* Overwritten env values tracks an indexmap instead of vector

* Refactor restore function

* Untrack removed vars properly

* Performance concerns

* Performance concerns

* Error handling

* Clippy

* Add type aliases for String and OsString

* Deletion almost works

* Working?

* Error handling and refactoring

* nicer errors

* Add TODO file

* Move outside of loop

* Error handling

* Reworking adding of vars

* Reworking adding of vars

* Ready for testing

* Refactoring

* Restore overwritten vals code

* todo.org

* Remove overwritten values tracking, as it is not needed

* Cleanup, stop tracking overwritten values as nu takes care of it

* Init autoenv command

* Initialize autoenv and autoenv trust

* autoenv trust toml

* toml

* Use serde for autoenv

* Optional directory arg

* Add autoenv untrust command

* ... actually add autoenv untrust this time

* OsString and paths

* Revert "OsString and paths"

This reverts commit e6eedf8824.

* Fix path

* Fix path

* Autoenv trust and untrust

* Start using autoenv

* Check hashes

* Use trust functionality when setting vars

* Remove unused code

* Clippy

* Nicer errors for autoenv commands

* Non-working errors

* Update error description

* Satisfy fmt

* Errors

* Errors print, but not nicely

* Nicer errors

* fmt

* Delete accidentally added todo.org file

* Rename direnv to autoenv

* Use ShellError instead of Error

* Change tests to pass, danger zone?

* Clippy and errors

* Clippy... again

* Replace match with or_else

* Use sha2 crate for hashing

* parsing and error msg

* Refactoring

* Only apply vars once

* if parent dir

* Delete vars

* Rework exit code

* Adding works

* restore

* Fix possibility of infinite loop

* Refactoring

* Non-working

* Revert "Non-working"

This reverts commit e231b85570.

* Revert "Revert "Non-working""

This reverts commit 804092e46a.

* Autoenv trust works without restart

* Cargo fix

* Script vars

* Serde

* Serde errors

* Entry and exitscripts

* Clippy

* Support windows and handle errors

* Formatting

* Fix infinite loop on windows

* Debugging windows loop

* More windows infinite loop debugging

* Windows loop debugging #3

* windows loop #4

* Don't return err

* Cleanup unused code

* Infinite loop debug

* Loop debugging

* Check if infinite loop is vars_to_add

* env_vars_to_add does not terminate, skip loop as test

* Hypothesis: std::env::current_dir() is messing with something

* Hypothesis: std::env::current_dir() is messing with something

* plz

* make clippy happy

* debugging in env_vars_to_add

* Debbuging env_vars_to_add #2

* clippy

* clippy..

* Fool clippy

* Fix another infinite loop

* Binary search for error location x)

* Binary search #3

* fmt

* Binary search #4

* more searching...

* closing in... maybe

* PLZ

* Cleanup

* Restore commented out functionality

* Handle case when user gives the directory "."

* fmt

* Use fs::canonicalize for paths

* Create optional script section

* fmt

* Add exitscripts even if no entryscripts are defined

* All sections in .nu-env are now optional

* Re-read config file each directory change

* Hot reload after autoenv untrust, don't run exitscripts if untrusted

* Debugging

* Fix issue with recursive adding of vars

* Thank you for finding my issues Mr. Azure

* use std::env
2020-07-06 05:34:00 +12:00
Joseph T. Lyons
9e82e5a2fa
Show entire table if number of rows requested for last is greater than table size (#2112)
* Show entire table if number of rows requested for last is greater than table size

* rustfmt

* Add test
2020-07-05 13:04:17 +12:00
Arash Outadi
8ea2307815
More informative error messages when "rm" fails (#2109)
* add a nicer error message

* small fix to message and remove log
2020-07-05 13:03:12 +12:00
Jonathan Turner
bbc5a28fe9
Fix buffering in lines command (#2111) 2020-07-05 12:20:58 +12:00
Arash Outadi
efd8a633f2
Align tables in "ls -f" (#2105)
* Stuff column with nothing if we have nothing

* Stuff columns at the very start

Remove unnecessary else clauses.
Add the unix cfg portion

* Added some tests and cfg windows

Not sure how I feel about these tests but it's better than nothing
2020-07-05 08:17:36 +12:00
Jonathan Turner
e75c44c95b
If command and touchups (#2106) 2020-07-05 07:40:04 +12:00
Jonathan Turner
eb02c773d0
Add 'str length' command (#2102) 2020-07-04 08:17:44 +12:00
Arash Outadi
e31e8d1550
Convert open/fetch to stream (#2028)
* Types lined up for open with stream

* Chunking stream

* Maybe I didn't need most of the Stream stuff after all?

* Some clean-up

* Merge weird cargo.lock

* Start moving some encoding logic to MaybeTextCodec

Will we lose the nice table formatting if we Stream? How do we get it back? Collect the Stream at the end?

* Clean-up and small refinements

* Put in auto-convert workaround

* Workaround to make sure bat functionality works

* Handle some easy error cases

* All tests pass

* Remove guessing logic

* Address clippy comments

* Pull latest master and fix MaybeTextCodec usage

* Add tag to enable autoview
2020-07-04 07:53:20 +12:00
Jonathan Turner
8775991c2d
Add 'split chars' command (#2101) 2020-07-04 07:09:38 +12:00
Jonathan Turner
de8e2841a0
Numbered each (#2100)
* Add --numbered to each

* Fix example tester and add numbered each
2020-07-03 20:43:55 +12:00
Jason Gedge
180290f3a8
Remove custom escaping for external args. (#2095)
Our own custom escaping unfortunately is far too simple to cover all cases.
Instead, the parser will now do no transforms on the args passed to an external
command, letting the process spawning library deal with doing the appropriate
escaping.
2020-07-03 11:29:28 +12:00
Darren Schroeder
7be49e43fd
added a few more command chars (#2086)
* added a few more command chars

* forgot my ole' friend clippy

* added unicode name synonums to characters
2020-07-01 17:34:11 -05:00
Jonathan Turner
0522023d4c
Bump to 0.16.0 (#2084) 2020-07-01 06:25:09 +12:00
Joseph T. Lyons
9876169f5d
Add dice subcommand to random command (#2082)
* Add dice subcommand to random command

* Update random dice test name

* Stream results of random dice

* Thanks Clippy!
2020-06-30 16:12:51 +12:00
Jonathan Turner
ed10aafa6f
Bubble errors even if pipeline isn't used (#2080) 2020-06-30 05:39:11 +12:00
Jonathan Turner
bcddeb3c1f
WIP (#2077) 2020-06-29 09:06:05 +12:00
Joseph T. Lyons
3f170c7fb8
Cal improvements (#2074)
* .get() already checks for the argument, don't need to use .has() as well

* Supplying the month-names flag should also cause the months column to show up, it should not require the -m flag first
2020-06-29 05:16:10 +12:00
Darren Schroeder
8d91d151bf
added raw to date for string output (#2075) 2020-06-28 09:01:13 -05:00
Darren Schroeder
a30901ff7d
added ability to request the date in a format (#2073) 2020-06-27 20:36:15 -05:00
Jonathan Turner
94a1968a88
Add command for printing special characters (#2072) 2020-06-28 09:46:30 +12:00
Jonathan Turner
dffc9c9b1c
Properly redirect invocations (#2070)
* Properly redirect invocations

* Don't convert with-env yet, as there's a random test failure
2020-06-28 09:04:57 +12:00
Darren Schroeder
8b3964f518
More ansi (#2067)
* added a few more options for ansi colors
not sure italic works, maybe it's font dependent

* fmt
2020-06-27 10:29:09 -05:00
Jonathan Turner
7fed9992c9
Bump deps and touchup (#2066) 2020-06-27 19:54:31 +12:00
Jonathan Turner
4e2a4236f8
Fix it expansion and add collect (#2065) 2020-06-27 17:38:19 +12:00
Jonathan Turner
05781607f4
Configurable built-in prompts (#2064)
* Add ansi, do, and prompt customization

* Fix test

* Cleanups
2020-06-27 10:37:31 +12:00
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
Kurtis
80ce8acf57
Add ThemedPalette (#1873)
* add theme module

* reorganize theme palette code

* improve tests

* move to newtype implementation for ThemeColor and fix Palette name.

* add dead code ignore for now

* fix allow dead code macro

* remove redundant import and unnecessary return

* fix ok_or clippy error

Co-authored-by: Kurtis Nusbaum <kcommiter@gmail.com>
2020-06-26 16:40:12 +12:00
Joseph T. Lyons
72a21ad619
Adds random command with uuid subcommand (#2050) 2020-06-25 17:51:09 +12:00
Darren Schroeder
6372d2a18c
Made starship usage configurable (#2049)
Co-authored-by: Darren Schroeder <fdncred@hotmail.com>
2020-06-25 17:44:55 +12:00
Ali Mousa
93144a0132
Make mode subcommand: math mode (#2043)
* Update calculate to return a table when Value is a table

* impl mode subcommand for math

* add tests for math mode subcommand

* add table/row tests for math mode subcommand

* fix formatting
2020-06-25 05:57:27 +12:00
Arash Outadi
1420cbafe4
Refactor out RunnableContext from calculate (#2037) 2020-06-24 06:24:33 +12:00
Darren Schroeder
d095cb91e4
bump which from 3 to 4.0.1 (#2035)
This release should work with reparse points like WinGet.
2020-06-22 12:58:10 -05:00
Darren Schroeder
e8476d8fbb
removed some comments (#2032)
removed comments that i shouldn't have left in
2020-06-22 08:30:43 -05: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
Jonathan Turner
89c737f456
Finish move to nu-table (#2025) 2020-06-21 07:25:07 +12:00
Joseph T. Lyons
853d7e7120
Math median tests and documentation additions (#2018)
* Add math median example and unit tests

* Update output of other all math ls command examples to keep consistent with math median output

* Fix output of math max example

* Update output of other math commands using pwd examples to keep data consistent
2020-06-20 00:28:03 -05: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
Jonathan Turner
fcbaefed52
Nu table (#2015)
* WIP

* Get ready to land nu-table

* Remove unwrap
2020-06-20 15:41:53 +12:00
Joseph T Lyons
088901b24f Rename average to avg 2020-06-19 18:59:00 -05:00
Darren Schroeder
6bfd8532e4
Bat config (#2010)
* WIP - changes to support bat config

* added bat configuration

* removed debug info

* clippy fix

* changed [bat] to [textview]

Co-authored-by: Darren Schroeder <fdncred@hotmail.com>
2020-06-19 15:08:59 -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
Andrés N. Robalino
94aac0e8dd Remove unused pattern matched tag fields. 2020-06-17 13:34:17 -05:00
Andrés N. Robalino
9f54d238ba Refactoring and more split-by flexibility. 2020-06-17 13:34:17 -05:00
Andrés N. Robalino
778e497903 Refactoring and more group-by flexibility. 2020-06-17 13:34:17 -05:00
Joseph T. Lyons
1b6f94b46c
Cal command code cleanup (#1990)
* Cal command code cleanup

* Reverting "index_map" back to "indexmap", since that is the convention used in the system
2020-06-17 08:00:49 +12: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
eb1ada6115
issue1332 - Fix for yamls with unquoted double curly braces (#1988)
* Gnarly hardcoded fix

* Whoops remove println
2020-06-17 07:12:04 +12:00
utam0k
831111edec
Pass the borrow instead of clone. (#1986) 2020-06-16 05:35:24 +12:00
Jonathan Turner
29ea29261d
Bump to 0.15.1 (#1984) 2020-06-15 09:54:30 +12:00
Jonathan Turner
ee835f75db
Last batch of removing async_stream (#1983) 2020-06-15 09:00:42 +12:00
Arash Outadi
bd7ac0d48e
Math Documentation (#1982)
* Adding math docs

* Add some comments to calculate

* Remove redudant message

Message already shows up in subcommands list

* Added not working example

Accidentantly

* Remove table
2020-06-15 08:42:15 +12:00
Jonathan Turner
d7b1480ad0
Another batch of removing async_stream (#1981) 2020-06-14 11:54:35 +12:00
Jonathan Turner
86b316e930
Another batch of removing async_stream (#1979)
* Another batch of removing async_stream

* Another batch of removing async_stream

* Another batch of removing async_stream
2020-06-14 10:01:44 +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
Jonathan Turner
40673e4599
Another batch of removing async_stream (#1978) 2020-06-14 07:13:36 +12:00
Joseph T. Lyons
bcfb084d4c
Remove async_stream from some commands (#1976) 2020-06-14 04:30:24 +12:00
Jonathan Turner
fe6d96e996
Another batch of converting commands away from async_stream (#1974)
* Another batch of removing async_stream

* merge master
2020-06-13 20:43:21 +12:00
Joseph T. Lyons
e24e0242d1
Removing async_stream! from some more commands (#1973)
* Removing async_stream! from some more commands

* Fix await error

* Fix Clippy warnings
2020-06-13 20:03:13 +12:00
Jonathan Turner
c959dc1ee3
Another batch of removing async_stream (#1972) 2020-06-13 16:03:39 +12:00
Jonathan Turner
d82ce26b44
Another batch of removing async_stream (#1971) 2020-06-13 11:40:23 +12:00
Jonathan Turner
935a5f6b9e
Another batch of removing async_stream (#1970) 2020-06-12 20:34:41 +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
a268e825aa
Allow config to be readonly (#1967) 2020-06-12 05:50:57 +12:00
Jonathan Turner
982f067d0e
Proper precedence history in math (#1966) 2020-06-12 05:17:08 +12:00
Jonathan Turner
e5a18eb3c2
Bump to 0.15.0 (#1955) 2020-06-10 05:33:59 +12:00
Jonathan Turner
3bb2c9beed
Rename env file to .nu-env (#1953) 2020-06-09 15:54:20 +12:00
Michael Nitschinger
2fa83b0bbe
Pub expose InterruptibleStream and InputStream. (#1952)
This allows crate users to make sure their long-running
streams can be interrupted with ctrl-c.
2020-06-09 05:17:19 +12:00
Sam Hedin
bf459e09cb
WIP: Per directory env-variables (#1943)
* Add args in .nurc file to environment

* Working dummy version

* Add add_nurc to sync_env command

* Parse .nurc file

* Delete env vars after leaving directory

* Removing vals not working, strangely

* Refactoring, add comment

* Debugging

* Debug by logging to file

* Add and remove env var behavior appears correct

However, it does not use existing code that well.

* Move work to cli.rs

* Parse config directories

* I am in a state of distress

* Rename .nurc to .nu

* Some notes for me

* Refactoring

* Removing vars works, but not done in a very nice fashion

* Refactor env_vars_to_delete

* Refactor env_vars_to_add()

* Move directory environment code to separate file

* Refactor from_config

* Restore env values

* Working?

* Working?

* Update comments and change var name

* Formatting

* Remove vars after leaving dir

* Remove notes I made

* Rename config function

* Clippy

* Cleanup and handle errors

* cargo fmt

* Better error messages, remove last (?) unwrap

* FORMAT PLZ

* Rename whitelisted_directories to allowed_directories

* Add comment to clarify how overwritten values are restored.
2020-06-08 19:55:25 +12:00
Joseph T. Lyons
ec7ff5960d
Remove async_stream! from some commands (#1951)
* Remove async_stream! from open.rs

* Ran rustfmt

* Fix Clippy warning

* Removed async_stream! from evaluate_by.rs

* Removed async_stream! from exit.rs

* Removed async_stream! from from_eml.rs

* Removed async_stream! from group_by_date.rs

* Removed async_stream! from group_by.rs

* Removed async_stream! from map_max.rs

* Removed async_stream! from to_sqlite.rs

* Removed async_stream! from to_md.rs

* Removed async_stream! from to_html.rs
2020-06-08 16:48:10 +12:00
Arash Outadi
545f70705e
ISSUE-1907 Disallow invalid top level TOML (#1946)
* Do not allow invalid top-level toml

Move recursive toml conversion into a helper func

* Forgot to format

* Forgot to use helper inside collect values

Added some additional tests
2020-06-08 08:02:37 +12:00
utam0k
48672f8e30
Assign variables when passed as an argument. (#1947) 2020-06-08 04:15:57 +12:00
Joseph T. Lyons
160191e9f4
Cal updates (#1945)
* Clean up `use` statements

* Update cal code to be ready for future data coloring
2020-06-07 15:52:42 +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
Joseph T. Lyons
ba6370621f
Removing async_stream! from some commands (#1940)
* Removing async_stream! from some commands

* Revert row.rs code

* Simplify logic for first.rs and skip.rs
2020-06-06 19:42:06 +12:00
Andrés N. Robalino
2a8ea88413 Bring back parse as built-in. 2020-06-04 15:21:13 -05:00
Jonathan Turner
05959d6a61
Bump to latest rustyline (#1937) 2020-06-05 05:50:12 +12:00
Joseph T. Lyons
012c99839c
Moving some commands off of async stream (#1934)
* Remove async_stream from rm

* Remove async_stream from sort_by

* Remove async_stream from split_by

* Remove dbg!() statement

* Remove async_stream from uniq

* Remove async_stream from mkdir

* Don't change functions from private to public

* Clippy fixes

* Peer-review updates
2020-06-04 20:42:23 +12:00
utam0k
5dd346094e
Cut out a function to generate a pharase in the Flags section. (#1930) 2020-06-04 19:09:43 +12: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
Jonathan Turner
ef4eefa96a
Bump more deps (#1921) 2020-05-31 08:54:47 +12:00
Jonathan Turner
4bdf27b173
Batch of moving commands off async_stream #3 (#1919)
* Batch of moving commands off async_stream #3

* remove commented-out section

* merge master
2020-05-31 06:31:50 +12:00
Oleksii Filonenko
741d7b9f10
Add rm_always_trash option to config (#1869)
* Add `rm_always_trash` option to config

* Add `--permanent` flag to `rm`

* `rm`: error if both `-t` and `-p` are present

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-05-31 06:31:34 +12:00
Andrés N. Robalino
ad43ef08e5 Support average for tables. 2020-05-30 10:33:09 -05:00
Jonathan Turner
092ee127ee
Batch of moving commands off async_stream (#1917) 2020-05-30 16:34:39 +12:00
Jonathan Turner
b84ff99e7f
Batch of moving commands off async_stream (#1916) 2020-05-30 11:36:04 +12:00
Andrés N. Robalino
48ee20782f Ensure end_filter plugin lifecycle stage gets called. 2020-05-29 04:03:25 -05:00
Jonathan Turner
360e8340d1
Move run to be async (#1913) 2020-05-29 20:22:52 +12:00
Jonathan Turner
3f9871f60d
Simplify plugin directory scanning (#1910) 2020-05-29 07:14:32 +12: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
98a3d9fff6
Allow echo to iterate ranges (#1905) 2020-05-28 06:07:53 +12:00
Joseph T. Lyons
49b0592e3c
Implement ctrl+c for the du command (#1901)
* Implement ctrl+c for the du command

* Ignore the "too many arguments" Clippy warning
2020-05-27 16:52:20 +12: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
Darren Schroeder
f0fc9e1038
Merge pivot options (#1888) 2020-05-25 18:40:25 -04:00
Jason Gedge
cb6ccc3c5a
Improve the simplified parse form. (#1875) 2020-05-25 14:19:49 -04:00
Joseph T. Lyons
07996ea93d
Remove as many of the typecasts as possible in the cal command (#1886)
* Remove as many of the typecasts as possible in the cal command

* Run rustfmt on cal.rs
2020-05-25 18:51:23 +12:00
Jason Gedge
005d76cf57
Fix broken ordering of args when parsing command with env vars. (#1841) 2020-05-24 19:26:27 -04:00
k-brk
8a99d112fc
Add --to-float to str plugin (#1872) 2020-05-24 18:11:49 -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
Aaron Christiansen
74c2daf665
Add completion for binaries on PATH (#1866) 2020-05-23 20:27:52 -04:00
Alexander James
aadbcf5ce8
Issue 1787 (#1827) 2020-05-23 20:08:39 -04:00
Kelli Little
460daf029b
Add space to bottom of table in 'light' mode (#1871) 2020-05-22 21:12:26 -04:00
Oleksii Filonenko
9e6ab33fd7
Add --regex flag to parse (#1863) 2020-05-22 10:13:58 -04:00
Darren Schroeder
5de30d0ae5
Tweak auto-rotate for single row output (#1861)
* added helper to convert data to strings
added ability to auto-rotate single row output
if row will be greater than terminal width

* Added pivot_to_fit config value

* Added ColumnPath to convert_to_string helper

* Figured out I had to run `cargo fmt --all -- --check`

Co-authored-by: Darren Schroeder <fdncred@hotmail.com>
2020-05-22 04:30:58 +12:00
Aaron Christiansen
97b9c078b1
Fix completer handling of paths with spaces (#1858)
* Fix completer handling of paths with spaces

* Satisfy Clippy for completer

* Satisfy cargo fmt for completer
2020-05-21 08:32:21 +12:00
Elton Leander Pinto
8dc5c34932
Save alias (#1852)
* figuring out error with lines

* make progress in printing of block

* support for external commands; fix some tiny bugs in formatting

* basic printing of block; going to experiment with bubbling raw input to the command itself to avoid potential edge cases

* remove fmt::Display impls for hir structs; bubbled raw_input to command args

* compiling checkpoint :)

* process raw input alias to remove save flag; do duplicates stored

* fix warnings; run clippy

* removed tmux log file

* fix bug in looking for same alias; changed unwraps to safe unwraps
2020-05-21 05:31:04 +12: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
James Campos
ae8c864934
default history size to 100k (#1845) 2020-05-20 07:28:06 +12:00
Jonathan Turner
ed80933806
String interpolation (#1849)
* Add string interpolation

* fix coloring

* A few more fixups + tests

* merge master again
2020-05-20 07:27:26 +12:00
Chris Pearce
ae87582cb6
Fix missing invocation errors (#1846) 2020-05-19 08:57:25 -04:00
Jonathan Turner
b89976daef
let format access variables also (#1842) 2020-05-19 16:20:09 +12:00
lightclient
3144dc7f93
add support for specifying max history size in config (#1829) (#1837) 2020-05-19 10:27:08 +12:00
Jason Gedge
6efabef8d3
Remove interpretation of Primitive::Nothing as the number 0. (#1836) 2020-05-18 15:18:46 -04:00
Jonathan Turner
0743b69ad5
Move from language-reporting to codespan (#1825) 2020-05-19 06:44:27 +12:00
Jason Gedge
5f1136dcb0
Fix newly added examples. (#1830) 2020-05-18 11:40:44 -04:00
Jason Gedge
acf13a6fcf
Add (near) automatic testing for command examples (#1777) 2020-05-18 08:56:01 -04:00
Sam
3fc4a9f142
added config check to disable auto pivoting of single row outputs (#1791)
* added config check to disable auto pivoting of single row outputs

* fixed change to use built-in boolean values
2020-05-18 20:42:22 +12:00
Shaurya Shubham
b6cdfb1b19
Remove the -n flag from shuffle (#1823) 2020-05-18 19:12:35 +12:00
Joseph T. Lyons
334685af23
Add some examples (#1821)
* Adds some examples

* Run rustfmt

* Fixed a few descriptions in the examples
2020-05-18 19:11:37 +12:00
Jonathan Turner
c475be2df8
Fix starship not getting the correct pwd (#1822) 2020-05-18 17:22:54 +12:00
Andrés N. Robalino
f18424a6f6 Remove test-bins feature. 2020-05-17 23:32:55 -05:00
Joseph T. Lyons
af6aff8ca3
Allow user to specify the indentation setting on the pretty flag for the to json command (#1818)
* Allow user to specify the indentation setting on the pretty flag for the to json command

* Use "JSON" over "json"
2020-05-18 06:48:58 +12:00
Kurtis
d4dd8284a6
create Palette trait (#1813)
* create Pallet trait

* correct spelling to palette

* move palette to it's own module
2020-05-18 05:48:57 +12:00
Shaurya Shubham
41e1aef369
Fix the insert command (#1815) 2020-05-17 08:30:52 -04:00
Joseph T. Lyons
e50db1a4de
Adds support to pretty format the json in to json (#1812)
* Current work on the --pretty flag for to json

* Deleted notes that were pushed by accident

* Fixed some errors
2020-05-17 16:43:10 +12:00
Jonathan Turner
0abc94f0c6
Bump some of our dependencies (#1809) 2020-05-17 10:34:10 +12:00
Jonathan Turner
48d06f40b1
Remove the old it-hacks from fetch and post (#1807) 2020-05-17 06:18:46 +12:00
Joseph T. Lyons
40ec8c41a0
Cal command updates (#1758)
* Calculate the quarter directly

* Group some data together, remove attribute to ignore Clippy warning

* Group items into structs and add methods

* Updates to cal command

* Update cal.rs

* Update cal.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-05-16 16:00:06 +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
Sam
822440d5ff
added nothing value for incalcuable dir sizes (#1789) 2020-05-15 12:53:18 -04:00
Andrés N. Robalino
fc8ee8e4b9
Extracted grouping by date to it's own subcommand. (#1792) 2020-05-15 04:16:09 -05:00
Xavier L'Heureux
5fbe5cf785
Use the directories crate instead of app_dirs (#1782)
The app_dirs crate is abandonned since quite a bit of time. Use the directories
crate instead, which is maintained and have more OS support.
2020-05-14 20:17:23 +12:00
Michael Nitschinger
e7f08cb21d
Allow external binary to register custom commands. (#1780)
This changeset contains everything that a separate binary needs to
register its own commands (including the new help function). It is
very possible that this commit misses other pub use exports, but
the contained ones work for our use cases so far.
2020-05-14 12:35:22 +12:00
Hoàng Đức Hiếu
e3b7e47515
cal: fix thursday typo (#1776) 2020-05-13 08:06:31 -04:00
Jonathan Turner
196991ae1e
Bump to 0.14.1 (#1772) 2020-05-13 20:03:45 +12:00
Joseph T. Lyons
9700b74407
Fix type in config flag description (#1769) 2020-05-13 14:21:57 +12:00
Bruno Heridet
803c6539eb
doc: fix nth examples (#1768) 2020-05-12 16:47:45 -04:00
Jason Gedge
75edcbc0d0
Simplify mv in FilesystemShell (#1587) 2020-05-12 16:40:45 -04:00
Jonathan Turner
b2eecfb110
Bump to 0.14 (#1766) 2020-05-13 04:32:51 +12:00
Jason Gedge
b0aa142542
Add examples for some more commands (#1765) 2020-05-13 03:54:29 +12:00
Bruno Heridet
247d8b00f8
doc: fix prepend example definition (#1761)
It seems that the description was copy-pasted by mistake from the
append command.
2020-05-12 19:46:21 +12:00
Jonathan Turner
0b520eeaf0
Add a batch of help examples (#1759) 2020-05-12 17:17:17 +12:00
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
180c1204f3
Use playground instead of depending on fixture format files. (#1726) 2020-05-07 06:58:35 -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
8a9fc6a721
Fix changing to a new Windows drive (#1721)
* Fix changing to a new Windows drive

* Update cli.rs
2020-05-07 05:51:03 +12: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
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
Darren Schroeder
d2ac506de3
Changes to allow plugins to be loaded in a multi-threaded manner (#1694)
* Changes to allow plugins to be loaded in a multi-threaded manner in order to decrease startup time.

* Ran rust fmt and clippy to find and fix first pass errors.
Updated launch.jason to make debugging easier in vscode.
Also added tasks.json so tasks like clippy can be ran easily.

* ran fmt again

* Delete launch.json

Remove IDE settings file

* Remove IDE settings file

* Ignore vscode IDE settings

* Cloned the context instead of Arc/Mutexing it.

Co-authored-by: Darren Schroeder <fdncred@hotmail.com>
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2020-05-05 06:15:24 +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
81ff598d6c
Fix column bugs associated with previous refactoring (#1705)
* Fix: the symlink target column will only dispaly if either the `full` or `with_symlink_targets` options are given

* If the metadata for every item in the size column is None, do not show the size column

* Do not show the symlink target column if the metadata is None for all the items in the table
2020-05-04 14:58:11 +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
Joseph T. Lyons
ef3049f5a1
Reduce some repetitive code in files.rs (#1692) 2020-05-02 11:14:29 -04:00
Darren Schroeder
e9e3fac59d
Remove bin.is_file() because it's expensive (#1689)
This one change takes the startup time from 2.8 seconds to 1.2 seconds in my testing on Windows.
2020-05-01 06:43:59 +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
Jonathan Turner
73d5310c9c
make it-expansion work through blocks when necessary (#1681) 2020-04-29 19:51:46 +12:00
Joseph T. Lyons
8d197e1b2f
Show symlink sizes in ls (#1680)
* Show symlink sizes in ls

* Reduce redundancy in the size code of ls
2020-04-29 19:23:26 +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
6abb9181d5
bump to 0.13.1 (#1670) 2020-04-27 18:50:14 +12:00