mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix for '-' arg after script name (#2631)
This commit is contained in:
parent
d7fa8c3207
commit
963d56fc5e
1 changed files with 19 additions and 1 deletions
20
cli/flags.rs
20
cli/flags.rs
|
@ -587,7 +587,7 @@ fn parse_script_args(
|
|||
continue;
|
||||
}
|
||||
|
||||
if !arg.starts_with('-') {
|
||||
if !arg.starts_with('-') || arg == "-" {
|
||||
argv.push(arg.to_string());
|
||||
continue;
|
||||
}
|
||||
|
@ -1541,5 +1541,23 @@ mod tests {
|
|||
);
|
||||
assert_eq!(subcommand, DenoSubcommand::Run);
|
||||
assert_eq!(argv, svec!["deno", "script.ts", "--help", "--foo", "bar"]);
|
||||
|
||||
let (flags, subcommand, argv) =
|
||||
flags_from_vec(svec!["deno", "script.ts", "foo", "bar"]);
|
||||
assert_eq!(flags, DenoFlags::default());
|
||||
assert_eq!(subcommand, DenoSubcommand::Run);
|
||||
assert_eq!(argv, svec!["deno", "script.ts", "foo", "bar"]);
|
||||
|
||||
let (flags, subcommand, argv) =
|
||||
flags_from_vec(svec!["deno", "script.ts", "-"]);
|
||||
assert_eq!(flags, DenoFlags::default());
|
||||
assert_eq!(subcommand, DenoSubcommand::Run);
|
||||
assert_eq!(argv, svec!["deno", "script.ts", "-"]);
|
||||
|
||||
let (flags, subcommand, argv) =
|
||||
flags_from_vec(svec!["deno", "script.ts", "-", "foo", "bar"]);
|
||||
assert_eq!(flags, DenoFlags::default());
|
||||
assert_eq!(subcommand, DenoSubcommand::Run);
|
||||
assert_eq!(argv, svec!["deno", "script.ts", "-", "foo", "bar"]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue