add $.extra_usage to modules (#11649)

- should fix https://github.com/nushell/nushell/issues/11648

# Description
this PR
- adds a test that should pass but fails
- adds `$.extra_usage` to the output of `scope modules`, fixing both the
new test and the linked issue

# User-Facing Changes
`$.extra_usage` is now a column in the output of `scope modules`

# Tests + Formatting
a new test case has been added to `correct_scope_modules_fields`

# After Submitting
This commit is contained in:
Antoine Stevan
2024-01-27 16:49:21 +01:00
committed by GitHub
parent 39b020037d
commit 859f7b3dc7
2 changed files with 11 additions and 2 deletions

View File

@ -504,10 +504,9 @@ impl<'e, 's> ScopeData<'e, 's> {
|block_id| Value::block(block_id, span),
);
let module_usage = self
let (module_usage, module_extra_usage) = self
.engine_state
.build_module_usage(*module_id)
.map(|(usage, _)| usage)
.unwrap_or_default();
Value::record(
@ -520,6 +519,7 @@ impl<'e, 's> ScopeData<'e, 's> {
"constants" => Value::list(export_consts, span),
"env_block" => export_env_block,
"usage" => Value::string(module_usage, span),
"extra_usage" => Value::string(module_extra_usage, span),
"module_id" => Value::int(*module_id as i64, span),
},
span,