Fix error message: custom commands cannot be const (#16393)

# Description

Fixes the error you get when you parse something like `const c = random
int` to no longer imply that custom commands can be `const`. My
understanding is that they currently cannot (though that feature is
being tracked at #15074).

# User-Facing Changes

* Improved error message

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
Harper Andrews
2025-08-19 04:02:26 -05:00
committed by GitHub
parent 778601b821
commit 458b8a5362

View File

@@ -1186,18 +1186,16 @@ This is an internal Nushell error, please file an issue https://github.com/nushe
span: Span,
},
// TODO: Update help text once custom const commands are supported
/// Tried running a command that is not const-compatible
///
/// ## Resolution
///
/// Only a subset of builtin commands, and custom commands built only from those commands, can
/// run at parse time.
/// Only a subset of builtin commands can run at parse time.
#[error("Not a const command.")]
#[diagnostic(
code(nu::shell::not_a_const_command),
help(
"Only a subset of builtin commands, and custom commands built only from those commands, can run at parse time."
)
help("Only a subset of builtin commands can run at parse time.")
)]
NotAConstCommand {
#[label("This command cannot run at parse time.")]