allow passing float value to custom command (#12879)

# Description
Fixes: #12691 

In `parse_short_flag`, it only checks special cases for
`SyntaxShape::Int`, `SyntaxShape::Number` to allow a flag to be a
number. This pr adds `SyntaxShape::Float` to allow a flag to be float
number.

# User-Facing Changes
This is possible after this pr:
```nushell
def spam [val: float] { $val }; 
spam -1.4
```

# Tests + Formatting
Added 1 test
This commit is contained in:
Wind
2024-05-16 16:50:29 +08:00
committed by GitHub
parent e20113a0eb
commit 1b8eb23785
2 changed files with 7 additions and 1 deletions

View File

@ -486,7 +486,7 @@ fn parse_short_flags(
&& matches!(
sig.get_positional(positional_idx),
Some(PositionalArg {
shape: SyntaxShape::Int | SyntaxShape::Number,
shape: SyntaxShape::Int | SyntaxShape::Number | SyntaxShape::Float,
..
})
)