You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a bit later, i realized there is the Value::update_data_at_cell_path which is used internally by the update command and thus should do what i want with both less code and less tests 😱
i tried applying the following patch
diff --git a/src/app.rs b/src/app.rs
index b85ad30..b1243e1 100644
--- a/src/app.rs+++ b/src/app.rs@@ -170,7 +170,7 @@ pub(super) fn run(
config: &Config,
) -> Result<Value> {
let mut state = State::from_value(input);
- let value = input.clone();+ let mut value = input.clone();
loop {
terminal.draw(|frame| tui::render_ui(frame, &value, &state, config))?;
@@ -187,12 +187,7 @@ pub(super) fn run(
exit: false,
result: Some(val),
..
- } => {- value- .clone()- .update_data_at_cell_path(&state.cell_path.members, val)- .expect("could not update the data");- }+ } => value = mutate_value_cell(&value, &state.cell_path, &val),
TransitionResult {
exit: false,
result: None,
but it does not do anything...
i mean nothing crashes, but the data is not changed 😕
The text was updated successfully, but these errors were encountered:
✔️ my own solution
while writing #6, i went and implemented a
Value
mutation function, seenu_plugin_explore/src/nu/value.rs
Lines 8 to 55 in 2efe508
which modified
value
recursively withval
at the givencell_path
.it works just fine: see the tests at
nu_plugin_explore/src/nu/value.rs
Lines 65 to 193 in 2efe508
❌ the Nushell built-in solution
a bit later, i realized there is the
Value::update_data_at_cell_path
which is used internally by theupdate
command and thus should do what i want with both less code and less tests 😱i tried applying the following patch
but it does not do anything...
i mean nothing crashes, but the data is not changed 😕
The text was updated successfully, but these errors were encountered: