nushell / nushell/nushell.github.io
Document nested modules and calling parent functions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 258
- Forks
- 561
- Avg merge
- 3h 20m
- Merged PRs (30d)
- 15
Description
I can't find any documentation for nested modules and calling parent module functions within a child module.
There seems to be no way to call the outermost parent module's baz function from within a child module. It will always prefer the next parent's baz function.
It is impossible to make the following code print baz in foo1. In my use case the function baz is actually called path, so it not only overwrites the second definition of path in foo1 but also makes the global nushell path module unusable within the bim() function in foo3.
Example code:
export module foo1 {
export def baz [] { print "baz foo1" }
export module foo2 {
export def baz [] { print "baz in foo2" }
export module foo3 {
export def bim [] {
print "bim in foo3"
# this will succeed and call "baz in foo2"
baz
# this will fail with `external foo1 not found`
# foo1 foo2 baz
# this will also fail with `external foo1 not found`
# foo1 baz
}
}
}
}
use foo1
foo1 foo2 foo3 bim # this will print "baz in foo2"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not identify a documentation file or test; start by reviewing the nested foo1/foo2/foo3 module example and the existing Nushell module documentation. Document how nested modules resolve parent functions, including whether the shown parent-qualified calls are supported and what behavior users should expect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100