Commit Graph

837 Commits

Author SHA1 Message Date
Andrés N. Robalino
3163b0d362 Data processing mvp histogram. 2019-11-12 02:08:28 -05:00
Andrés N. Robalino
21f48577ae Reductions placeholder. 2019-11-12 02:08:28 -05:00
Jonathan Turner
0f405f24c7 Bump dep versions 2019-11-11 06:48:49 +13:00
Jonathan Turner
59ab11e932
Merge pull request #947 from jonathandturner/bump_and_plugin_load
Bump Nu version and change plugin load logic for debug
2019-11-09 21:29:09 -08:00
Jonathan Turner
df302d4bac Bump Nu version and change plugin load logic for debug 2019-11-10 16:44:05 +13:00
Jonathan Turner
62a5250554 Add format command 2019-11-10 13:14:59 +13:00
Jonathan Turner
9043970e97
Merge pull request #943 from drmason13/from_csv-add-separator-arg
Add --separator argument to from_csv
2019-11-09 15:09:32 -08:00
Jonathan Turner
bab58576b4 Rename read to parse 2019-11-10 11:26:44 +13:00
David Mason
4a6122905b fmt: cargo fmt --all 2019-11-08 15:27:29 +00:00
David Mason
15986c598a Add --separator command to from_csv
The command takes a string, checks it is a single character and then
passes it to csv::ReaderBuilder via .delimiter() method as a u8.
2019-11-08 15:06:33 +00:00
Jonathan Turner
44a1686a76 Move flags help to last 2019-11-06 15:28:26 +13:00
Jason Gedge
f012eb7bdd Eliminate is_first_command by defaulting to Value::nothing() 2019-11-03 20:06:59 -05:00
Andrés N. Robalino
f966394b63
Merge pull request #888 from andrasio/data-primitives
WIP [data processing]
2019-11-03 16:52:21 -05:00
Andrés N. Robalino
889d2bb378 Isolate feature. 2019-11-03 16:36:47 -05:00
Andrés N. Robalino
8860d8de8d At the moment, ColumnPaths represent a set of Members (eg. package.authors is a column path of two members)
The functions for retrieving, replacing, and inserting values into values all assumed they get the complete
column path as regular tagged strings. This commit changes for these to accept a tagged values instead. Basically
it means we can have column paths containing strings and numbers (eg. package.authors.1)

Unfortunately, for the moment all members when parsed and deserialized for a command that expects column paths
of tagged values will get tagged values (encapsulating Members) as strings only.

This makes it impossible to determine whether package.authors.1 package.authors."1" (meaning the "number" 1) is
a string member or a number member and thus prevents to know and force the user that paths enclosed in double
quotes means "retrieve the column at this given table" and that numbers are for retrieving a particular row number
from a table.

This commit sets in place the infraestructure needed when integer members land, in the mean time the workaround
is to convert back to strings the tagged values passed from the column paths.
2019-11-03 06:30:32 -05:00
Andrés N. Robalino
d7b768ee9f Fallback internally to String primitives until Member int serialization lands. 2019-11-03 05:38:47 -05:00
Andrés N. Robalino
6ea8e42331 Move column paths to support broader value types. 2019-11-03 05:38:47 -05:00
Andrés N. Robalino
1b784cb77a
Merge pull request #913 from andrasio/tests-builtins
`get` preserves anchored inputs.
2019-11-03 05:11:09 -05:00
Andrés N. Robalino
4a0ec1207c Preserve anchored meta data for all get queries in the pipeline 2019-11-03 03:49:06 -05:00
Jonathan Turner
3b42655b51 Make column logic in from-ssv optional 2019-11-03 17:04:59 +13:00
Jonathan Turner
c317094947 Add support for config --set_into 2019-11-03 12:43:15 +13:00
Jonathan Turner
243df63978 Move config to async_stream 2019-11-03 12:22:30 +13:00
Jonathan Turner
cd30fac050 Approach fix differently 2019-11-03 08:57:28 +13:00
Jonathan Turner
f589d3c795 Fix 907 and improve substring 2019-11-03 07:49:28 +13:00
Jonathan Turner
51879d022e
Merge pull request #895 from Flare576/substring
Adds new substring function to str plugin
2019-11-02 17:42:45 +13:00
Jonathan Turner
2260b3dda3
Update str.rs 2019-11-02 17:25:20 +13:00
Jonathan Turner
129ee45944 Add initial support for env vars 2019-11-02 16:41:58 +13:00
Jonathan Turner
e92d4b2ccb Rename add to insert 2019-11-02 14:47:14 +13:00
Jonathan Turner
7801c03e2d plugin_nu_path 2019-11-02 13:36:21 +13:00
Flare576
763bbe1c01 Updated Doc, error on bad input 2019-11-01 17:25:08 -05:00
Jonathan Turner
a3679f0f4e Make echo more flexible with data types 2019-11-02 08:15:53 +13:00
Jonathan Turner
e75fdc2865
Merge pull request #897 from nushell/modernize_external_tokens
Modernize external tokens
2019-11-02 06:18:38 +13:00
Yehuda Katz
4be88ff572 Modernize external parse and improve trace
The original purpose of this PR was to modernize the external parser to
use the new Shape system.

This commit does include some of that change, but a more important
aspect of this change is an improvement to the expansion trace.

Previous commit 6a7c00ea adding trace infrastructure to the syntax coloring
feature. This commit adds tracing to the expander.

The bulk of that work, in addition to the tree builder logic, was an
overhaul of the formatter traits to make them more general purpose, and
more structured.

Some highlights:

- `ToDebug` was split into two traits (`ToDebug` and `DebugFormat`)
  because implementations needed to become objects, but a convenience
  method on `ToDebug` didn't qualify
- `DebugFormat`'s `fmt_debug` method now takes a `DebugFormatter` rather
  than a standard formatter, and `DebugFormatter` has a new (but still
  limited) facility for structured formatting.
- Implementations of `ExpandSyntax` need to produce output that
  implements `DebugFormat`.

Unlike the highlighter changes, these changes are fairly focused in the
trace output, so these changes aren't behind a flag.
2019-11-01 08:45:45 -07:00
Flare576
cd058db046 Substring option for str plugin
Adds new substr function to str plugin with tests and documentation

Function takes a start/end location as a string in the form "##,##", both sides of comma are optional, and
behaves like Rust's own index operator [##..##].
2019-10-31 19:49:17 -05:00
Andrés N. Robalino
e31ed66610 get :: support fetching rows using numbers in column path. 2019-10-31 14:20:22 -05:00
Andrés N. Robalino
b54ce921dd Better error messages. 2019-10-31 04:36:08 -05:00
Andrés N. Robalino
7614ce4b49 Allow handling errors with failure callbacks. 2019-10-30 17:46:40 -05:00
Andrés N. Robalino
cea8fab307 "Integers" in column paths fetch a row from a table. 2019-10-30 05:55:26 -05:00
Jonathan Turner
a9cd6b4f7a Format files 2019-10-30 20:04:39 +13:00
Jonathan Turner
81691e07c6 Add prepend and append commands 2019-10-30 19:54:06 +13:00
Jonathan Turner
3820fef801 Add a simple read/parse plugin to better handle text data 2019-10-30 11:33:36 +13:00
Andrés N. Robalino
392ff286b2 This commit is ongoing work for making Nu working with data processing
a joy. Fundamentally we embrace functional programming principles for
transforming the dataset from any format picked up by Nu. This table
processing "primitive" commands will build up and make pipelines
composable with data processing capabilities allowing us the valuate,
reduce, and map, the tables as far as even composing this declartively.

On this regard, `split-by` expects some table with grouped data and we
can use it further in interesting ways (Eg. collecting labels for
visualizing the data in charts and/or suit it for a particular chart
of our interest).
2019-10-29 16:04:31 -05:00
Jonathan Turner
b6824d8b88
Merge pull request #886 from notryanb/fetch-from-variable
WIP fetch command - support reading url from variable
2019-10-29 13:52:35 +13:00
Ryan Blecher
e09160e80d add ability to create PathBuf from string to avoid type mismatch 2019-10-28 20:22:51 -04:00
Jonathan Turner
30b6eac03d Allow updating path in config 2019-10-29 10:22:31 +13:00
Jonathan Turner
53911ebecd Add support for :path 2019-10-29 07:40:34 +13:00
Jonathan Turner
bc309705a9
Merge pull request #883 from jonathandturner/magic_env_vars
Add support for $nu:config and $nu:env
2019-10-29 07:22:44 +13:00
Jonathan Turner
1de80aeac3 Add support for :config and :env 2019-10-29 06:51:08 +13:00
Andrés N. Robalino
1eaaf368ee
Merge pull request #879 from andrasio/tilde-pattern
Expand tilde in patterns.
2019-10-28 12:09:02 -05:00
Jonathan Turner
3f600c5b82 Fix build issues 2019-10-28 18:30:14 +13:00
Jonathan Turner
fbd980f8b0 Add descriptions to arguments 2019-10-28 18:15:35 +13:00
Jonathan Turner
aed386b3cd Always save history, add history command 2019-10-28 05:58:39 +13:00
Andrés N. Robalino
540cc4016e Expand tilde in patterns. 2019-10-27 03:55:30 -05:00
Andrés N. Robalino
2706ae076d Move out tags when parsing and building tree nodes. 2019-10-25 18:31:25 -05:00
Jonathan Turner
d160e834eb rustyline git and add plus for filenames 2019-10-26 05:43:31 +13:00
Jonathan Turner
571b33a11c
Merge pull request #857 from andrasio/group-by
Can group rows by given column name.
2019-10-23 18:25:52 +13:00
Andrés N. Robalino
f1630da2cc Suggest a column name in case one unknown column is supplied. 2019-10-22 20:10:42 -05:00
Andrés N. Robalino
16751b5dee color escaped external command. 2019-10-22 19:29:45 -05:00
Yehuda Katz
6a7c00eaef Finish the job of moving shapes into the stream
This commit should finish the `coloring_in_tokens` feature, which moves
the shape accumulator into the token stream. This allows rollbacks of
the token stream to also roll back any shapes that were added.

This commit also adds a much nicer syntax highlighter trace, which shows
all of the paths the highlighter took to arrive at a particular coloring
output. This change is fairly substantial, but really improves the
understandability of the flow. I intend to update the normal parser with
a similar tracing view.

In general, this change also fleshes out the concept of "atomic" token
stream operations.

A good next step would be to try to make the parser more
error-correcting, using the coloring infrastructure. A follow-up step
would involve merging the parser and highlighter shapes themselves.
2019-10-22 16:19:22 -07:00
Antti Keränen
8f035616a0 Fix enter crashing on nonexistent file
Fixes #839
2019-10-22 15:22:47 +03:00
Andrés N. Robalino
4329629ee9 baseline coverage for xml parsing. 2019-10-22 03:47:59 -05:00
Andrés N. Robalino
0611f56776 Can group cells by given column name. 2019-10-20 18:42:07 -05:00
Jonathan Turner
8923e91e39
Merge pull request #856 from andrasio/value-improvements
Improvements to Value mutable operations.
2019-10-21 06:57:36 +13:00
Jonathan Turner
d6e6811bb9
Merge pull request #854 from jdvr/master
#194 Connect `rm` command to platform's recycle bin
2019-10-21 05:16:48 +13:00
Andrés N. Robalino
f24bc5c826 Improvements to Value mutable operations. 2019-10-20 06:55:56 -05:00
jdvr
c209d0d487 194 Fixed file format 2019-10-19 22:52:39 +02:00
jdvr
74dddc880d "#194 Added trash switch checked before normal rm command action" 2019-10-19 22:31:18 +02:00
Jonathan Turner
f3c41bbdf1
Merge pull request #851 from t-hart/pr/remove-unwrap-unit
Deletes impl From<&str> for Unit
2019-10-20 07:29:07 +13:00
Jonathan Turner
c45ddc8f22
Merge pull request #848 from andrasio/column_path-inc
Inc plugin increments appropiately given a table containing a version.
2019-10-20 07:27:47 +13:00
Jonathan Turner
84a98995bf
Merge pull request #845 from t-hart/from-ssv/headers-as-markers
`from-ssv` logic updated
2019-10-20 07:26:04 +13:00
notryanb@gmail.com
43fbf4345d remove comment and add test for averaging integers 2019-10-18 20:43:37 -04:00
notryanb@gmail.com
8262c2dd33 add support for average on byte columns and fmt the code 2019-10-18 20:43:37 -04:00
notryanb@gmail.com
0e86430ea3 get very basic average working 2019-10-18 20:43:37 -04:00
jdvr
fc1301c92d #194 Added trash crate and send files to the trash using a flag 2019-10-19 00:41:24 +02:00
Thomas Hartmann
e913e26c01 Deletes impl From<&str>
The code still compiles, so this doesn't seem to break anything. That also means
it's not critical to fix it, but having dead code around isn't great either.
2019-10-18 20:02:24 +02:00
Andrés N. Robalino
5ce4b12cc1 Inc plugin increments appropiately given a table containing a version in it. 2019-10-18 07:30:36 -05:00
Antti Keränen
321629a693 Fix size comparison in 'where size'
Fixes #840
2019-10-17 22:57:02 +03:00
Thomas Hartmann
f21405399c Formats file. 2019-10-17 09:56:06 +02:00
Thomas Hartmann
305ca11eb5 Changes the parsing to use the full value of the final column.
Previously it would split the last column on the first separator value found
between the start of the column and the end of the row. Changing this to using
everything from the start of the column to the end of the string makes it behave
more similarly to the other columns, making it less surprising.
2019-10-17 09:40:00 +02:00
Thomas Hartmann
9b1ff9b566 Updates the table creation logic.
The table parsing/creation logic has changed from treating every line the same
to processing each line in context of the column header's placement. Previously,
lines on separate rows would go towards the same column as long as they were the
same index based on separator alone. Now, each item's index is based on vertical
alignment to the column header.

This may seem brittle, but it solves the problem of some tables operating with
empty cells that would cause remaining values to be paired with the wrong
column.

Based on kubernetes output (get pods, events), the new method has shown to have
much greater success rates for parsing.
2019-10-17 00:25:43 +02:00
Thomas Hartmann
a0ed6ea3c8 Adds new tests and updates old ones.
New tests are added to test for additional cases that might be trickier to
handle with the new logic.

Old tests are updated where their expectations are no longer expected to hold true.
For instance: previously, lines would be treated separately, allowing any index
offset between columns on different rows, as long as they had the same row index
as decided by a separator. When this is no longer the case, some things need to
be adjusted.
2019-10-17 00:17:58 +02:00
Jonathan Turner
9a02fac0e5
Rename <unknown> to <value> 2019-10-17 07:28:49 +13:00
Thomas Hartmann
74b0e4e541 Adds more info to the usage string. 2019-10-15 23:20:06 +02:00
Thomas Hartmann
f8d44e732b Updates default minimum spaces to allow single spaces by default. 2019-10-15 22:05:47 +02:00
Thomas Hartmann
0d2044e72e Changes flag to minimum-spaces. 2019-10-15 22:05:32 +02:00
Thomas Hartmann
294c2c600d Update the usage string to match the readme. 2019-10-15 21:10:15 +02:00
Thomas Hartmann
d32e97b812 Implements variable space separator length, version 1. 2019-10-15 20:48:06 +02:00
Thomas Hartmann
81affaa584 Adds tests for allowed-spaces option. 2019-10-15 19:10:38 +02:00
Andrés N. Robalino
0373006710 Formatting. 2019-10-15 05:42:24 -05:00
Andrés N. Robalino
ec2e35ad81 'last' gets last row if no amount desired given. 2019-10-15 05:41:34 -05:00
Andrés N. Robalino
821ee5e726 count command introduced. 2019-10-15 05:19:06 -05:00
Andrés N. Robalino
96ef478fbc Better error messages. 2019-10-15 04:18:35 -05:00
Andrés N. Robalino
3f60c9d416 'first' gets first row if no amount desired given. 2019-10-15 04:17:55 -05:00
Jonathan Turner
bd6d8189f8
Merge pull request #830 from t-hart/pull-req/from-master
[DRAFT] Adds `from-ssv` command.
2019-10-15 18:28:43 +13:00
Yehuda Katz
d1ebc55ed7
Merge pull request #831 from nushell/coloring_in_tokens
Start moving coloring into the token stream
2019-10-14 18:31:21 -07:00
Yehuda Katz
f20f3f56c7 Start moving coloring into the token stream
The benefit of this is that coloring can be made atomic alongside token
stream forwarding.

I put the feature behind a flag so I can continue to iterate on it
without possibly regressing existing functionality. It's a lot of places
where the flags have to go, but I expect it to be a short-lived flag,
and the flags are fully contained in the parser.
2019-10-14 16:11:00 -07:00
Thomas Hartmann
d21389d549 Removes unwrap.
A rogue unwrap had been left in the code, but has now been replaced by an option.
2019-10-15 00:24:32 +02:00
Thomas Hartmann
b2c53a0967 Updates commands to work after tag is no longer copy. 2019-10-14 23:14:45 +02:00
Thomas Hartmann
65546646a7 Pull in upstream changes. 2019-10-14 23:05:52 +02:00
Jason Gedge
ee8cd671cb Fix bug with multiple input objects to an external command.
Previously, we would build a command that looked something like this:

  <ex_cmd> "$it" "&&" "<ex_cmd>" "$it"

So that the "&&" and "<ex_cmd>" would also be arguments to the command,
instead of a chained command. This commit builds up a command string
that can be passed to an external shell.
2019-10-14 16:47:12 -04:00