importing non-existing subcommand from module is possible
Open
Nobody has claimed this yet.
A:error-unhelpful
A:parser
A:scoping/name-resolution
category:bug
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
as title
How to reproduce
with std
- run
nu -nto not loadstd clipby default - run
use std clip foo clipcan be run
with a module
- define the
foomodule
module foo { export def bar [] {} }
- import
foo barwith a trailing garbage
use foo bar brr
barcan be run
Expected behavior
with std
i expected something like
Error: nu::parser::export_not_found
× Export not found.
╭─[entry #17:1:1]
1 │ use std "clip foo"
· ─────┬────
· ╰── could not find imports
╰────
or
Error: nu::parser::export_not_found
× Export not found.
╭─[entry #18:1:1]
1 │ use std foo
· ─┬─
· ╰── could not find imports
╰────
with a module
same expectations
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.85.1 |
| branch | main |
| commit_hash | 8c507dc984693c45b0440adf63a94e0410b4bc42 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.70.0 (90c541806 2023-05-31) |
| rust_channel | 1.70.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.70.0 (ec8a8a0ca 2023-04-25) |
| build_time | 2023-10-04 18:35:49 +02:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash, which, zip |
| installed_plugins | gstat, nu_plugin_explore |
Additional context
No response
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
Start by reproducing the issue with nu -n, use std clip foo, and the foo module example using use foo bar brr. Trace the parser entry point for use imports and verify that trailing or nonexistent exports produce an export_not_found error rather than making the valid command available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100