mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
Add $nu.scope.engine_state
(#5739)
* Add number of items present in engine state * Rename num_decls column to num_commands
This commit is contained in:
parent
b42ef45c7c
commit
5bae7e56ef
@ -1174,6 +1174,40 @@ pub fn create_scope(
|
||||
span,
|
||||
});
|
||||
|
||||
let engine_state_cols = vec![
|
||||
"source_bytes".to_string(),
|
||||
"num_vars".to_string(),
|
||||
"num_commands".to_string(),
|
||||
"num_aliases".to_string(),
|
||||
"num_blocks".to_string(),
|
||||
"num_modules".to_string(),
|
||||
"num_env_vars".to_string(),
|
||||
];
|
||||
|
||||
let engine_state_vals = vec![
|
||||
Value::int(engine_state.next_span_start() as i64, span),
|
||||
Value::int(engine_state.num_vars() as i64, span),
|
||||
Value::int(engine_state.num_decls() as i64, span),
|
||||
Value::int(engine_state.num_aliases() as i64, span),
|
||||
Value::int(engine_state.num_blocks() as i64, span),
|
||||
Value::int(engine_state.num_modules() as i64, span),
|
||||
Value::int(
|
||||
engine_state
|
||||
.env_vars
|
||||
.values()
|
||||
.map(|overlay| overlay.len() as i64)
|
||||
.sum(),
|
||||
span,
|
||||
),
|
||||
];
|
||||
|
||||
output_cols.push("engine_state".to_string());
|
||||
output_vals.push(Value::Record {
|
||||
cols: engine_state_cols,
|
||||
vals: engine_state_vals,
|
||||
span,
|
||||
});
|
||||
|
||||
Ok(Value::Record {
|
||||
cols: output_cols,
|
||||
vals: output_vals,
|
||||
|
Loading…
Reference in New Issue
Block a user