vself: allow arbitrary arguments

pull/4576/head
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
1 changed files with 6 additions and 8 deletions

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'