explore: pass config to views at creation time (#13312)

cc: @zhiburt

This is an internal refactoring for `explore`.

Previously, views inside `explore` were created with default/incorrect
configuration and then the correct configuration was passed to them
using a function called `setup()`. I believe this was because
configuration was dynamic and could change while `explore` was running.

After https://github.com/nushell/nushell/pull/10259, configuration can
no longer be changed on the fly. So we can clean this up by removing
`setup()` and passing configuration to views when they are created.
This commit is contained in:
Reilly Wood
2024-07-07 06:09:59 -07:00
committed by GitHub
parent 6ce5530fc2
commit 83081f9852
13 changed files with 93 additions and 150 deletions

View File

@ -1,3 +1,5 @@
use crate::views::ViewConfig;
use super::pager::{Pager, Transition};
use anyhow::Result;
use nu_protocol::{
@ -49,5 +51,6 @@ pub trait ViewCommand {
engine_state: &EngineState,
stack: &mut Stack,
value: Option<Value>,
config: &ViewConfig,
) -> Result<Self::View>;
}