mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
Avoid update_last_command_context "No command run" error (#6483)
* 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>
This commit is contained in:
parent
daec3fc3d3
commit
3278d290be
3 changed files with 8 additions and 4 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -4078,8 +4078,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "reedline"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d84e8704e9eb141e73ac426c72af95eb195d4c3221a11ea92d5709f4a025adb5"
|
||||
source = "git+https://github.com/nushell/reedline?branch=main#fe889ae5c4b4fa7492cf6f138ccd4274b0f682cf"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"crossterm 0.24.0",
|
||||
|
|
|
@ -121,3 +121,6 @@ debug = false
|
|||
[[bin]]
|
||||
name = "nu"
|
||||
path = "src/main.rs"
|
||||
|
||||
[patch.crates-io]
|
||||
reedline = { git = "https://github.com/nushell/reedline", branch = "main" }
|
||||
|
|
|
@ -324,7 +324,8 @@ pub fn evaluate_repl(
|
|||
Ok(Signal::Success(s)) => {
|
||||
let history_supports_meta =
|
||||
matches!(config.history_file_format, HistoryFileFormat::Sqlite);
|
||||
if history_supports_meta && !s.is_empty() {
|
||||
if history_supports_meta && !s.is_empty() && line_editor.has_last_command_context()
|
||||
{
|
||||
line_editor
|
||||
.update_last_command_context(&|mut c| {
|
||||
c.start_timestamp = Some(chrono::Utc::now());
|
||||
|
@ -445,7 +446,8 @@ pub fn evaluate_repl(
|
|||
},
|
||||
);
|
||||
|
||||
if history_supports_meta && !s.is_empty() {
|
||||
if history_supports_meta && !s.is_empty() && line_editor.has_last_command_context()
|
||||
{
|
||||
line_editor
|
||||
.update_last_command_context(&|mut c| {
|
||||
c.duration = Some(cmd_duration);
|
||||
|
|
Loading…
Reference in a new issue