v.pref: cleanup V options, support the documented -output and -backend

pull/10238/head
Delyan Angelov 2021-05-28 09:07:06 +03:00
parent 8a109b031c
commit 39de06c200
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 8 additions and 12 deletions

View File

@ -45,10 +45,6 @@ NB: the build flags are shared with the run command too:
If value is not provided, it is assumed to be set to `true`.
`value` should be `1` or `0` to indicate `true` and `false` respectively otherwise.
-e <experiment>, -experiments <experiment>
Enable the specified experiment.
Currently, the only experiment available is: `prealloc`
-g
Compile the executable in debug mode, allowing code to be debugged more easily.

View File

@ -396,13 +396,13 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
'-translated' {
res.translated = true
}
'-color' {
res.use_color = .always
}
'-m32', '-m64' {
res.m64 = arg[2] == `6`
res.cflags += ' $arg'
}
'-color' {
res.use_color = .always
}
'-nocolor' {
res.use_color = .never
}
@ -478,7 +478,7 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
res.build_options << '$arg "$res.cflags.trim_space()"'
i++
}
'-define', '-d' {
'-d', '-define' {
if current_args.len > 1 {
define := current_args[1]
parse_define(mut res, define)
@ -495,8 +495,8 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
arg, '10').int()
i++
}
'-o' {
res.out_name = cmdline.option(current_args, '-o', '')
'-o', '-output' {
res.out_name = cmdline.option(current_args, arg, '')
if res.out_name.ends_with('.js') {
res.backend = .js
}
@ -505,8 +505,8 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
}
i++
}
'-b' {
sbackend := cmdline.option(current_args, '-b', 'c')
'-b', '-backend' {
sbackend := cmdline.option(current_args, arg, 'c')
res.build_options << '$arg $sbackend'
b := backend_from_string(sbackend) or { continue }
res.backend = b