* 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
* 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
* 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!
* 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`
* 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
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
──────┴──────────
```
* 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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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`
* 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>
* 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
* 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
* 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
* 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
* 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>
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.
* 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
* 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
* 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
* 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
* make trim apply to strings contained in tables (also at deeper nesting
levels), not just top-level strings
* remove unnecessary clone (thanks clippy)
* from-eml initial ver
* Adding tests for `from-eml`
* Add eml to prepares_and_decorates_filesystem_source_files
* Sort the file order
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
* 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
* Refactor InputStream and affected commands.
First, making `values` private and leaning on the `Stream` implementation makes
consumes of `InputStream` less likely to have to change in the future, if we
change what an `InputStream` is internally.
Second, we're dropping `Option<InputStream>` as the input to pipelines,
internals, and externals. Instead, `InputStream.is_empty` can be used to check
for "emptiness". Empty streams are typically only ever used as the first input
to a pipeline.
* Add run_external internal command.
We want to push external commands closer to internal commands, eventually
eliminating the concept of "external" completely. This means we can consolidate
a couple of things:
- Variable evaluation (for example, `$it`, `$nu`, alias vars)
- Behaviour of whole stream vs per-item external execution
It should also make it easier for us to start introducing argument signatures
for external commands,
* Update run_external.rs
* Update run_external.rs
* Update run_external.rs
* Update run_external.rs
Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
* Better message error
* Use custom canonicalize in FileStructure build
* Better glob error in ls
* Use custom canonicalize, remove some duplicate code in cd.
* Enable recursive copying with patterns.
* Change test to fit new error message
* Test recursive with glob pattern
* Show that not matches were found in cp
* Fix typo in message error
* Change old canonicalize usage, follow newest changes
* Making Commands match what UntaggedValue needs
* WIP
* WIP
* WIP
* Moved to expressions for conditions
* Add 'each' command to use command blocks
* More cleanup
* Add test for 'each'
* Instead use an expression block
* headers plugin
* Remove plugin
* Add non-functioning headers command
* Add ability to extract headers from first row
* Refactor header extraction
* Rebuild indexmap with proper headers
* Rebuild result properly
* Compiling, probably wrapped too much?
* Refactoring
* Deal with case of empty header cell
* Deal with case of empty header cell
* Fix formatting
* Fix linting, attempt 2.
* Move whole_stream_command(Headers) to more appropriate section
* ... more linting
* Return Err(ShellError...) instead of panic, yield each row instead of entire table
* Insert Column[index] if no header info is found.
* Update error description
* Add initial test
* Add tests for headers command
* Lint test cases in headers
* Change ShellError for headers, Add sample_headers file to utils.rs
* Add empty sheet to test file
* Revert "Add empty sheet to test file"
This reverts commit a4bf38a31d.
* Show error message when given empty table
* Fix '/' and '..' not being valid mv targets
If `/` or `../` is specified as the destination for `mv`, it will fail with an error message saying it's not a valid destination. This fixes it to account for the fact that `Path::file_name` return `None` when the file name evaluates to `/` or `..`. It will only take the slow(er) path if `Path::file_name` returns `None` in its initial check.
Fixes#1291
* Add test
* Custom canonicalize method for FilesystemShell.
* Use custom canonicalize method.
Fixed missing import.
* Move function body to already impl body.
* Create test that aims to resolve.
This improves incremental build time when working on what was previously
the root package. For example, previously all plugins would be rebuilt
with a change to `src/commands/classified/external.rs`, but now only
`nu-cli` will have to be rebuilt (and anything that depends on it).