mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
Remove --flag: bool
support (#11541)
# Description This is a follow up to: #11365 After this pr, `--flag: bool` is no longer allowed. I think `ParseWarning::Deprecated` is useful when we want to deprecated something at syntax level, so I just leave it there for now. # User-Facing Changes ## Before ``` ❯ def foo [--b: bool] {} Error: × Deprecated: --flag: bool ╭─[entry #15:1:1] 1 │ def foo [--b: bool] {} · ──┬─ · ╰── `--flag: bool` is deprecated and will be removed in 0.90. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html ╰──── ``` ## After ``` ❯ def foo [--b: bool] {} Error: × Type annotations are not allowed for boolean switches. ╭─[entry #2:1:1] 1 │ def foo [--b: bool] {} · ──┬─ · ╰── Remove the `: bool` type annotation. ╰──── ``` # Tests + Formatting Done
This commit is contained in:
@ -172,19 +172,6 @@ fn def_default_value_should_restrict_implicit_type() {
|
||||
assert!(actual2.err.contains("expected int"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_boolean_flags() {
|
||||
let actual = nu!("def foo [--x: bool] { $x }; foo --x");
|
||||
assert!(actual.err.contains("flag missing bool argument"));
|
||||
let actual = nu!("def foo [--x: bool = false] { $x }; foo");
|
||||
assert_eq!(actual.out, "false");
|
||||
let actual = nu!("def foo [--x: bool = false] { $x }; foo --x");
|
||||
assert!(actual.err.contains("flag missing bool argument"));
|
||||
// boolean flags' default value should be null
|
||||
let actual = nu!("def foo [--x: bool] { $x == null }; foo");
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_wrapped_with_block() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user