mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 03:34:58 +02:00
Use 'table' during internal->external (#898)
* Use 'table' during internal->external * Preserve more of config
This commit is contained in:
@ -178,10 +178,20 @@ impl Stack {
|
||||
|
||||
match config {
|
||||
Ok(config) => config.into_config(),
|
||||
Err(e) => {
|
||||
println!("Can't find {} in {:?}", CONFIG_VARIABLE_ID, self);
|
||||
Err(e)
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_config(&mut self, name: &str, value: Value) {
|
||||
if let Some(Value::Record { cols, vals, .. }) = self.vars.get_mut(&CONFIG_VARIABLE_ID) {
|
||||
for col_val in cols.iter().zip(vals.iter_mut()) {
|
||||
if col_val.0 == name {
|
||||
*col_val.1 = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cols.push(name.to_string());
|
||||
vals.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,10 @@ impl PipelineData {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn is_nothing(&self) -> bool {
|
||||
matches!(self, PipelineData::Value(Value::Nothing { .. }, ..))
|
||||
}
|
||||
|
||||
pub fn into_value(self, span: Span) -> Value {
|
||||
match self {
|
||||
PipelineData::Value(Value::Nothing { .. }, ..) => Value::nothing(span),
|
||||
|
Reference in New Issue
Block a user