1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vself: allow arbitrary arguments

This commit is contained in:
Enzo Baldisserri 2020-04-24 12:36:27 +02:00 committed by GitHub
parent a3382a5319
commit 288db055ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,15 +10,13 @@ fn main() {
vroot := os.dir(vexe) vroot := os.dir(vexe)
os.chdir(vroot) os.chdir(vroot)
mut cmd := '$vexe -o v2 cmd/v' self_idx := os.args.index('self')
if os.args.len >= 3 && os.args[2] == '-prod' { args := os.args[1..self_idx]
cmd = '$vexe -o v2 -prod cmd/v' args_str := args.join(' ')
println('V self compiling (-prod mode)...') options := if args.len > 0 { '($args_str)' } else { '' }
} println('V self compiling ${options}...')
else {
println('V self compiling...')
}
cmd := '$vexe -o v2 $args_str cmd/v'
result := os.exec(cmd) or { panic(err) } result := os.exec(cmd) or { panic(err) }
if result.exit_code != 0 { if result.exit_code != 0 {
mut err := 'Permission denied' mut err := 'Permission denied'