v run: fix 'v run' without any other argument

pull/4418/head
pancake 2020-04-15 11:16:07 +02:00 committed by GitHub
parent fde83aff0b
commit c0491285f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -184,12 +184,17 @@ fn parse_args(args []string) (&pref.Preferences, string) {
} }
else if command == 'run' { else if command == 'run' {
res.is_run = true res.is_run = true
res.path = args[command_pos+1] if command_pos + 1 < args.len {
res.run_args = if command_pos+1 < args.len { args[command_pos+2..] } else { []string } res.path = args[command_pos + 1]
res.run_args = args[command_pos+2..]
} else {
eprintln('v run: no v files listed')
exit(1)
}
} }
if command == 'build-module' { if command == 'build-module' {
res.build_mode = .build_module res.build_mode = .build_module
res.path = args[command_pos+1] res.path = args[command_pos + 1]
} }
if res.is_verbose { if res.is_verbose {
println('setting pref.path to "$res.path"') println('setting pref.path to "$res.path"')