mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
fix var names coming from long/short flags (#6142)
This commit is contained in:
parent
9695331eed
commit
c8adb06ca7
@ -3226,7 +3226,14 @@ pub fn parse_signature_helper(
|
||||
String::from_utf8_lossy(short_flag).to_string();
|
||||
let chars: Vec<char> = short_flag.chars().collect();
|
||||
let long = String::from_utf8_lossy(&flags[0][2..]).to_string();
|
||||
let variable_name = flags[0][2..].to_vec();
|
||||
let mut variable_name = flags[0][2..].to_vec();
|
||||
|
||||
(0..variable_name.len()).for_each(|idx| {
|
||||
if variable_name[idx] == b'-' {
|
||||
variable_name[idx] = b'_';
|
||||
}
|
||||
});
|
||||
|
||||
if !is_variable(&variable_name) {
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::Expected(
|
||||
|
Loading…
Reference in New Issue
Block a user