mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
help generate_docs | flatten crashes nushell (#3099)
* fix case where parent_name was {nu, term} and possibly others in the future by doing an extra test first to see if if the *parent_name key actually exists in cmap * update with help generate_docs testing
This commit is contained in:
@ -67,10 +67,12 @@ pub fn generate_docs(scope: &Scope) -> Value {
|
||||
if name.contains(' ') {
|
||||
let split_name = name.split_whitespace().collect_vec();
|
||||
let parent_name = split_name.first().expect("Expected a parent command name");
|
||||
let sub_names = cmap
|
||||
.get_mut(*parent_name)
|
||||
.expect("Expected a entry for parent");
|
||||
sub_names.push(name.to_owned());
|
||||
if cmap.contains_key(*parent_name) {
|
||||
let sub_names = cmap
|
||||
.get_mut(*parent_name)
|
||||
.expect("Expected a entry for parent");
|
||||
sub_names.push(name.to_owned());
|
||||
}
|
||||
} else {
|
||||
cmap.insert(name.to_owned(), Vec::new());
|
||||
};
|
||||
|
Reference in New Issue
Block a user