Skip to content

Flags do not respect default values when a value of type nothing is passed #17016

@karitham

Description

@karitham

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    X:controversialThere's disagreement over if/how this should be implemented. PRs implementing this may not be mergedsemanticsPlaces where we should define/clarify nushell's semanticsstatus:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions