mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
utils: add args to launch_tool
This commit is contained in:
parent
28ffe2a6ee
commit
7e538d7401
@ -36,7 +36,7 @@ fn main_v() {
|
||||
if args.len == 0 {
|
||||
println('For usage information, quit V REPL using `exit` and use `v help`')
|
||||
}
|
||||
util.launch_tool(false, 'vrepl')
|
||||
util.launch_tool(false, 'vrepl', os.args[1..])
|
||||
return
|
||||
}
|
||||
args_and_flags := util.join_env_vflags_and_os_args()[1..]
|
||||
@ -61,7 +61,7 @@ fn main_v() {
|
||||
// Note for future contributors: Please add new subcommands in the `match` block below.
|
||||
if command in simple_cmd {
|
||||
// External tools
|
||||
util.launch_tool(prefs.is_verbose, 'v' + command)
|
||||
util.launch_tool(prefs.is_verbose, 'v' + command, os.args[1..])
|
||||
return
|
||||
}
|
||||
match command {
|
||||
@ -69,7 +69,7 @@ fn main_v() {
|
||||
invoke_help_and_exit(args)
|
||||
}
|
||||
'new', 'init' {
|
||||
util.launch_tool(prefs.is_verbose, 'vcreate')
|
||||
util.launch_tool(prefs.is_verbose, 'vcreate', os.args[1..])
|
||||
return
|
||||
}
|
||||
'translate' {
|
||||
@ -77,7 +77,7 @@ fn main_v() {
|
||||
return
|
||||
}
|
||||
'search', 'install', 'update', 'remove' {
|
||||
util.launch_tool(prefs.is_verbose, 'vpm')
|
||||
util.launch_tool(prefs.is_verbose, 'vpm', os.args[1..])
|
||||
return
|
||||
}
|
||||
'get' {
|
||||
|
@ -102,11 +102,11 @@ pub fn set_vroot_folder(vroot_path string) {
|
||||
os.setenv('VEXE', os.real_path(os.join_path(vroot_path, vname)), true)
|
||||
}
|
||||
|
||||
pub fn launch_tool(is_verbose bool, tool_name string) {
|
||||
pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
|
||||
vexe := pref.vexe_path()
|
||||
vroot := os.dir(vexe)
|
||||
set_vroot_folder(vroot)
|
||||
tool_args := args_quote_paths_with_spaces(os.args[1..])
|
||||
tool_args := args_quote_paths_with_spaces(args)
|
||||
tool_exe := path_of_executable(os.real_path('$vroot/cmd/tools/$tool_name'))
|
||||
tool_source := os.real_path('$vroot/cmd/tools/${tool_name}.v')
|
||||
tool_command := '"$tool_exe" $tool_args'
|
||||
|
Loading…
Reference in New Issue
Block a user