From ebac3bebb17eac9f51ad69bbb8cea47a4ce5c376 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 18 May 2022 07:03:00 +0300 Subject: [PATCH] pref: pass -v after a command, to the command only, do not set verbose mode on --- vlib/v/pref/pref.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 40f9f7758c..af09f065d7 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -237,7 +237,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin } res.run_only = os.getenv('VTEST_ONLY_FN').split_any(',') mut command := '' - mut command_pos := 0 + mut command_pos := -1 // for i, arg in args { for i := 0; i < args.len; i++ { arg := args[i] @@ -289,6 +289,10 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin res.is_help = true } '-v' { + if command_pos != -1 { + // a -v flag after the command, is intended for the command, not for V itself + continue + } // `-v` flag is for setting verbosity, but without any args it prints the version, like Clang if args.len > 1 { res.is_verbose = true