From 39de06c200e8e241b1204c52bed3467d2a1b568d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 28 May 2021 09:07:06 +0300 Subject: [PATCH] v.pref: cleanup V options, support the documented -output and -backend --- cmd/v/help/build.txt | 4 ---- vlib/v/pref/pref.v | 16 ++++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/v/help/build.txt b/cmd/v/help/build.txt index 2f31846dc4..f7ae69a121 100644 --- a/cmd/v/help/build.txt +++ b/cmd/v/help/build.txt @@ -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 , -experiments - 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. diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index f99baef2ea..634311d5d3 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -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