* Add a 'commandline' command for manipulating the current buffer
from `executehostcommand` keybindings. Inspired by fish:
https://fishshell.com/docs/current/cmds/commandline.html
* Update to development reedline
Includes nushell/reedline#472
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
* Terminate REPL if not connected to tty input
If the standard input stream is not a TTY abort the REPL execution.
Solves a problem as the current REPL tries to be IO fault tolerant and
would indefinetely fail when crossterm tries to handle the STDIN.
Fixesnushell/nushell#6452
* Improve the error message
* Avoid update_last_command_context "No command run" error
When using `executehostcommand` bindings without having run actual user input commands yet,
update_last_command_context is guaranteed to fail. A function has been added to reedline
that allows checking for this case.
* Update to most recent reedline
Includes bugfixes around the (SQlite) history
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
* remove unnecessary FlatShape
* add proptest
* remove files that belonged in another PR
* more tests, more chars
* add exception for parser error unrelated ot PR
* Fix ps command CPU usage on Apple Silicon M1 macs. #4142
The cpu user and system times returned my libproc are not in
nanoseconds; they are in mach ticks units. This is not documented very
well. The convert from mach ticks to ns, the kernel provides a timebase
info function and datatype:
https://developer.apple.com/documentation/driverkit/3433733-mach_timebase_info
The commit makes the PS command work for me.
* Cargo fmt of previous commit.
* Clippy format suggestion
Co-authored-by: Ondrej Baudys <ondrej.baudys@nextgen.net>
* Test commands for proper names and search terms
Assert that the `Command.name()` is equal to `Signature.name`
Check that search terms are not just substrings of the command name as
they would not help finding the command.
* Clean up search terms
Remove redundant terms that just replicate the command name.
Try to eliminate substring between search terms, clean up where
necessary.
* Revert "Fix intermittent test crash (#6268)"
This reverts commit 555d9ee763.
* make a working version again
* try second impl
* add
* fmt
* check stdin is atty before acquire stdin
* add libc
* clean comment
* fix typo
* Update after Reedline API update
* Remove references to deleted `ReedlineEvent::ActionHandler`
* Update `DescriptionMenu` implementation for the new `Menu` trait
API changes that work on `Editor` rather than `LineBuffer` objects
* Update reedline
Includes nushell/reedline#460
Co-authored-by: Ben Parks <bnprks+git@gmail.com>
* Add decimals to int when using `into string --decimals`
* Add tests for `into string` when converting int with `--decimals`
* Apply formatting
* Merge `into_str` test files
* Comment out unused code and add TODOs
* Use decimal separator depending on system locale
* Add test helper to run closure in different locale
* Add tests for int-to-string conversion using different locales
* Add utils function to get system locale
* Add panic message when locking mutex fails
* Catch and resume panic later to prevent Mutex poisoning when test fails
* Move test to `nu-test-support` to keep `nu-utils` free of `nu-*` dependencies
See https://github.com/nushell/nushell/pull/6085#issuecomment-1193131694
* Rename test support fn `with_fake_locale` to `with_locale_override`
* Move `get_system_locale()` to `locale` module
* Allow overriding locale with special env variable (when not in release)
* Use special env var to override locale during testing
* Allow callback to return a value in `with_locale_override()`
* Allow multiple options in `nu!` macro
* Allow to set locale as `nu!` macro option
* Use new `locale` option of `nu!` macro instead of `with_locale_override`
Using the `locale` options does not lock the `LOCALE_OVERRIDE_MUTEX`
mutex in `nu-test-support::locale_override` but instead calls the `nu`
command directly with the `NU_LOCALE_OVERRIDE` environment variable.
This allows for parallel test excecution.
* Fix: Add option identifier for `cwd` in usage of `nu!` macro
* Rely on `Display` trait for formatting `nu!` macro command
- Removed the `DisplayPath` trait
- Implement `Display` for `AbsolutePath`, `RelativePath` and
`AbsoluteFile`
* Default to locale `en_US.UTF-8` for tests when using `nu!` macro
* Add doc comment to `nu!` macro
* Format code using `cargo fmt --all`
* Pass function directly instead of wrapping the call in a closure
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
* Pass function to `or_else()` instead of calling it inside `or()`
https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
* Fix: Add option identifier for `cwd` in usage of `nu!` macro
* when spawned process during register plugin, pass env to child process
* tweak comment
* tweak comment
* remove trailing whitespace
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
`rstest = 0.12` added support for asynchronous timeouts during testing
thus requiring a larger set of dependencies. Since `rstest = 0.14` this
can be disabled if not used.
Should keep build times for local or CI tests in check.
* add a new welcome banner to nushell
* remove top line
* tweaked colors and wording
* changed to dimmed white
* removed a comment
* make config nu stand out a little
* fix type-o