v.pref: prevent `Too many targets.` from triggering when the command is an external one
parent
ac7feb9bca
commit
0142d58aa6
|
@ -95,7 +95,7 @@ fn (app App) gen_api_for_module_in_os(mod_name string, os_name string) string {
|
|||
}
|
||||
mpath := os.join_path('vlib', mod_name.replace('.', '/'))
|
||||
tmpname := '/tmp/${mod_name}_${os_name}.c'
|
||||
prefs, _ := pref.parse_args(['-os', os_name, '-o', tmpname, '-shared', mpath])
|
||||
prefs, _ := pref.parse_args([], ['-os', os_name, '-o', tmpname, '-shared', mpath])
|
||||
mut b := builder.new_builder(prefs)
|
||||
b.compile_c()
|
||||
mut res := []string{}
|
||||
|
|
|
@ -10,7 +10,7 @@ import v.util
|
|||
import v.builder
|
||||
|
||||
const (
|
||||
simple_cmd = [
|
||||
external_tools = [
|
||||
'fmt',
|
||||
'up',
|
||||
'vet',
|
||||
|
@ -63,14 +63,14 @@ fn main() {
|
|||
} else {
|
||||
mut args_and_flags := util.join_env_vflags_and_os_args()[1..].clone()
|
||||
args_and_flags << ['run', '-']
|
||||
pref.parse_args(args_and_flags)
|
||||
pref.parse_args(external_tools, args_and_flags)
|
||||
}
|
||||
}
|
||||
util.launch_tool(false, 'vrepl', os.args[1..])
|
||||
return
|
||||
}
|
||||
args_and_flags := util.join_env_vflags_and_os_args()[1..]
|
||||
prefs, command := pref.parse_args(args_and_flags)
|
||||
prefs, command := pref.parse_args(external_tools, args_and_flags)
|
||||
if prefs.is_verbose {
|
||||
// println('args= ')
|
||||
// println(args) // QTODO
|
||||
|
@ -95,7 +95,7 @@ fn main() {
|
|||
}
|
||||
// Start calling the correct functions/external tools
|
||||
// Note for future contributors: Please add new subcommands in the `match` block below.
|
||||
if command in simple_cmd {
|
||||
if command in external_tools {
|
||||
// External tools
|
||||
util.launch_tool(prefs.is_verbose, 'v' + command, os.args[1..])
|
||||
return
|
||||
|
|
|
@ -145,7 +145,7 @@ pub mut:
|
|||
cache_manager vcache.CacheManager
|
||||
}
|
||||
|
||||
pub fn parse_args(args []string) (&Preferences, string) {
|
||||
pub fn parse_args(known_external_commands []string, args []string) (&Preferences, string) {
|
||||
mut res := &Preferences{}
|
||||
$if x64 {
|
||||
res.m64 = true // follow V model by default
|
||||
|
@ -417,7 +417,8 @@ pub fn parse_args(args []string) (&Preferences, string) {
|
|||
if command == 'run' {
|
||||
break
|
||||
}
|
||||
} else if is_source_file(command) && is_source_file(arg) {
|
||||
} else if is_source_file(command) && is_source_file(arg)
|
||||
&& command !in known_external_commands {
|
||||
eprintln('Too many targets. Specify just one target: <target.v|target_directory>.')
|
||||
exit(1)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue