Skip to content

Commit

Permalink
v.pref: fix regression of command flags not working, when there is a …
Browse files Browse the repository at this point in the history
…subfolder, named after the command, in the current working folder (#21647)
  • Loading branch information
ttytm authored Jun 10, 2024
1 parent 53ac41f commit 100b3b0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions vlib/v/pref/pref.v
Original file line number Diff line number Diff line change
Expand Up @@ -962,12 +962,11 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
// arguments for e.g. fmt should be checked elsewhere
continue
}
if res.is_vsh && command_idx < i {
// Allow for `script.vsh abc 123 -option`, because -option is for the .vsh program, not for v
continue
}
if command == 'doc' {
// Allow for `v doc -comments file.v`
if command_idx < i && (res.is_vsh || (is_source_file(command)
&& command in known_external_commands)) {
// When running programs, let them be responsible for the arguments passed to them.
// E.g.: `script.vsh cmd -opt` or `v run hello_world.v -opt`.
// But detect unknown arguments when building them. E.g.: `v hello_world.v -opt`.
continue
}
err_detail := if command == '' { '' } else { ' for command `${command}`' }
Expand Down

0 comments on commit 100b3b0

Please sign in to comment.