Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: fix regression of command flags not working #21647

Merged
merged 5 commits into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading