The introduction of `use <file.nu>` added the possibility of calling
`working_set.add_file()` more than once per parse pass. Some of the
logic handling the file contents offsets prevented it from working and
hopefully, this commit fixes it.
In some rare cases, the global predeclarations would clash, for example:
> module spam { export def foo [] { "foo" } }; def foo [] { "bar" }
In the example, the `foo [] { "bar" }` would get predeclared first, then
the predeclaration would be overwritten and consumed by `foo [] {"foo"}`
inside the module, then when parsing the actual `foo [] { "bar" }`, it
would not find its predeclaration.
Hiding definitions now should work correctly with repeated use of 'use',
'def' and 'hide' keywords.
The key change is that 'hide foo' will hide all definitions of foo
that were defined/used within the scope (those from other scopes are
still available). This makes the logic simpler and I found it leads to a
simpler mental map: you don't need to remember the order of defined/used
commands withing the scope -- it just hides all.
* Fixes a panic with defining two commands with the same name caused by
declaration not found after predeclaration.
* Adds a new error if a custom command is defined more than once in one
block.
* Add some tests
* Hiding logic is simplified and fixed so you can hide and unhide the
same def repeatedly.
* Separates predeclared ids into its own data structure to protect them
from hiding. Otherwise, you could hide the predeclared variable and
the actual def would panic.
* compiles on nightly now. (breaking change)
* less deps
* Switch over to new resolver
(it's been stable for a while.)
* let's leave num-format for another PR
* Allow different names for ...rest
* Resolves#3945
* This change requires an explicit name for the rest argument in `WholeStreamCommand`,
which is why there are so many changed files.
* Remove redundant clone
* Add tests
* nuframe in its own type in UntaggedValue
* Removed eager dataframe from enum
* Dataframe created from list of values
* Corrected order in dataframe columns
* Returned tag from stream collection
* Removed series from dataframe commands
* Arithmetic operators
* forced push
* forced push
* Replace all command
* String commands
* appending operations with dfs
* Testing suite for dataframes
* Unit test for dataframe commands
* improved equality for dataframes
* moving all dataframe operations to protocol
* objects in dataframes
* Removed cloning when converting to row
* nuframe in its own type in UntaggedValue
* Removed eager dataframe from enum
* Dataframe created from list of values
* Corrected order in dataframe columns
* Returned tag from stream collection
* Removed series from dataframe commands
* Arithmetic operators
* forced push
* forced push
* Replace all command
* String commands
* appending operations with dfs
* Testing suite for dataframes
* Unit test for dataframe commands
* improved equality for dataframes
* moving all dataframe operations to protocol
* nuframe in its own type in UntaggedValue
* Removed eager dataframe from enum
* Dataframe created from list of values
* Corrected order in dataframe columns
* Returned tag from stream collection
* Removed series from dataframe commands
* Arithmetic operators
* forced push
* forced push
* Replace all command
* String commands
* appending operations with dfs
* Testing suite for dataframes
* Unit test for dataframe commands
* improved equality for dataframes
* kind of works but not what we really want
* updated `into binary` and `first` to work better together
* attempt to fix wasm build problem
* attempt #2 to fix wasm stuff
* Type in command description
* filter name change
* Clean column name
* Clippy error and updated polars version
* Lint correction in file
* CSV Infer schema optional
* Correct float operations
* changes in series castings to allow other types
* Clippy error correction
* Removed lists from command signatures
* Added not command for series
* take command with args
* set with idx command
In Nu we have variables (E.g. $var-name) and these contain `Value` types.
This means we can bind to variables any structured data and column path syntax
(E.g. `$variable.path.to`) allows flexibility for "querying" said structures.
Here we offer completions for these. For example, in a Nushell session the
variable `$nu` contains environment values among other things. If we wanted to
see in the screen some environment variable (say the var `SHELL`) we do:
```
> echo $nu.env.SHELL
```
with completions we can now do: `echo $nu.env.S[\TAB]` and we get suggestions
that start at the column path `$nu.env` with vars starting with the letter `S`
in this case `SHELL` appears in the suggestions.
* Output error when ls into a file without permission
* math sqrt
* added test to check fails when ls into prohibited dir
* fix lint
* math sqrt with tests and doc
* trigger wasm build
* Update filesystem_shell.rs
* Fix Running echo .. starts printing integers forever
* Fixed panic on operations with very large durations
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
* plugin: basic from_mp4 implementation
This patch introduces a very basic implementation of from_mp4, with only
a few bits of meta-data available. The rest of the available meta-data
(which is more than half left), will be included in a later patch
* Mp4: Almost all track metadata is implemented
Only meta-data that is not implemented is duration, facing some weird
issue I am going to check on later
* Mp4: All meta-data fields implemented
All meta-data fields that can be retrieved are now retrieved, with the
exception of duration for both tracks and the entire file itself because
there is still an issue. However, that will be fixed in the upcoming
patches
* fix: UntaggedValue::duration() serializes correctly now
Previous to this patch, there was an issue where when you would use
UntaggedValue::duration() it would result in an invalid JSONRPC
resulting string when using the protocol. This patch fixes this issue
* Mp4: Duration fixed for file and tracks
* plugins: Add plugin extra to src/plugins
* Mp4: Replace unwrap() with expect()
* Fix: Remove test mp4 file
* enable theming of the command line syntax
* added missing flatshape, sorted flatshapes for easier reading.
* sorted flat shapes again and saved it this time
* added sample rwb.json syntax them file to docs
* Sample command
* Join command with checks
* More dataframes commands
* Groupby and aggregate commands
* Missing feature dataframe flag
* Renamed file
* New commands for dataframes
* error parser and df reference
* filter command for dataframes
* removed name from nu_dataframe
* commands to save to parquet and csv
* polars new version
* new dataframe commands
* series type and print
* Series basic arithmetics
* Add new column to dataframe
* Command names changed to nushell standard
* Sample command
* Join command with checks
* More dataframes commands
* Groupby and aggregate commands
* Missing feature dataframe flag
* Renamed file
* New commands for dataframes
* error parser and df reference
* filter command for dataframes
* removed name from nu_dataframe
* commands to save to parquet and csv
* Dataframe MVP
* Removed test csv file
* Dataframe MVP
* Removed test csv file
* New revision polars
* New revision polars
* csv file reader
* argument parser for file reader
* Parser from Row primitive
* Column conversion
* Added as f32 and f64
* Parsing row to dataframe
* Removed repeated push to vector
* Accept table values to create dataframe
* Removed default serde
* Dataframe to rows to show data
* Save name of file with dataframe
* Usage example
* Upgrade polars version
* Clippy changes
* Added print function with head and tail
* Move dataframe struct to folder
* Lock file after running tests and merge
* Optional feature for dataframe
* Removed dataframe from plugins
* Update primitive.rs
Co-authored-by: JT <jonathandturner@users.noreply.github.com>
* Implement minmax for Range; Simplify range command
* Port random integer to enginep; New FromValue impl
Now, FromValue is implemented for Tagged<Range> to allow extracting args
into this type.
* Make sure range value extraction fails properly
The range endpoint extraction methods now return error instead of
silently clipping the value. This now makes `random integer ..-4` fail
properly since -4 can't be cast as u64.
* Port random decimal to enginep & Refactor
This added a way to interpret Range limits as f64 and a Primitive helper
to get its value as f64.
A side effect of this commit is that it is now possible to specify the
command bounds as true decimals. E.g., `random decimal 0.0..3.14` does
not clip 3.14 to 3.
* Fix array index out of bounds error.
Error occured when computing levenshtein_distance of two strings where
str.len() is not equal to str.chars().collect::<Vec<_>>().len()
* Add test for levenshtein_distance