diff --git a/cmd/v/help/build.txt b/cmd/v/help/build.txt index 84ce0a9c50..e8dd9f0af2 100644 --- a/cmd/v/help/build.txt +++ b/cmd/v/help/build.txt @@ -1,4 +1,4 @@ -Usage: v [build flags] ['build'] +Usage: v [build flags] This command compiles the given target, along with their dependencies, into an executable. diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 5b5d3f15e6..3466e7ba26 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -384,6 +384,10 @@ pub fn parse_args(args []string) (&Preferences, string) { i++ } else { + if command == 'build' && (arg.ends_with('.v') || os.exists(command)) { + eprintln('Use `v $arg` instead.') + exit(1) + } if arg[0] == `-` { if arg[1..] in list_of_flags_with_param { // skip parameter