mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01: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
Cargo.lock
generated
3
Cargo.lock
generated
@ -4078,8 +4078,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "reedline"
|
name = "reedline"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/nushell/reedline?branch=main#fe889ae5c4b4fa7492cf6f138ccd4274b0f682cf"
|
||||||
checksum = "d84e8704e9eb141e73ac426c72af95eb195d4c3221a11ea92d5709f4a025adb5"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossterm 0.24.0",
|
"crossterm 0.24.0",
|
||||||
|
@ -121,3 +121,6 @@ debug = false
|
|||||||
[[bin]]
|
[[bin]]
|
||||||
name = "nu"
|
name = "nu"
|
||||||
path = "src/main.rs"
|
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)) => {
|
Ok(Signal::Success(s)) => {
|
||||||
let history_supports_meta =
|
let history_supports_meta =
|
||||||
matches!(config.history_file_format, HistoryFileFormat::Sqlite);
|
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
|
line_editor
|
||||||
.update_last_command_context(&|mut c| {
|
.update_last_command_context(&|mut c| {
|
||||||
c.start_timestamp = Some(chrono::Utc::now());
|
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
|
line_editor
|
||||||
.update_last_command_context(&|mut c| {
|
.update_last_command_context(&|mut c| {
|
||||||
c.duration = Some(cmd_duration);
|
c.duration = Some(cmd_duration);
|
||||||
|
Loading…
Reference in New Issue
Block a user