Flags do not respect default values when a value of type `nothing` is passed
Open
Nobody has claimed this yet.
semantics
status:needs-triage
X:controversial
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 79
Description
Bug report form
- I have done a basic search of the issue tracker to find any existing issues that are similar.
- I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
Flags do not respect default values when a value of type nothing is passed
How to reproduce
def concrete [--platform: string = "default_value"] {
print $"platform is ($platform)"
}
def main [--platform: string] {
concrete --platform=$platform
}
prints platform is
Expected behavior
Expected nu to print platform is default_value
Configuration
github:nixos/nixpkgs/nixos-unstable nu, nothing else
| key | value |
|---|---|
| version | 0.108.0 |
| major | 0 |
| minor | 108 |
| patch | 0 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.89.0 (29483883e 2025-08-04) (built from a source tarball) |
| cargo_version | cargo 1.89.0 (c24e10642 2025-06-23) |
| build_time | 1980-01-01 00:00:00 +00:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, network, plugin, rustls-tls, sqlite, trash-support |
| installed_plugins | polars 0.104.1 |
| experimental_options | example=false, reorder-cell-paths=true, pipefail=false, enforce-runtime-annotations=false |
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 running the reproducible Nushell definitions from the report and confirm that passing a nothing value produces an empty string instead of the declared default. Trace the flag argument and default-value handling to identify the relevant entry point. Done means the example prints platform is default_value, with a regression test covering this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100