initial commit
This commit is contained in:
47
cmd/runner.vsh
Executable file
47
cmd/runner.vsh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env -S v -n -w -cg -gc none -cc tcc -d use_openssl -enable-globals run
|
||||
|
||||
import os
|
||||
import time
|
||||
import flag
|
||||
import herocode.runner
|
||||
import freeflowuniverse.herolib.core.redisclient
|
||||
|
||||
mut fp := flag.new_flag_parser(os.args)
|
||||
fp.application('runner')
|
||||
fp.version('v0.1.0')
|
||||
fp.description('Runner in Vlang')
|
||||
fp.skip_executable()
|
||||
|
||||
// Define the flags
|
||||
runner_name := fp.string('name', `n`, 'test_runner', 'name of the runner')
|
||||
namespace := fp.string('namespace', `s`, '', 'namespace of the runner')
|
||||
redis_url := fp.string('redis_url', `r`, '127.0.0.1:6379', 'redis url')
|
||||
help_requested := fp.bool('help', `h`, false, 'Show help message')
|
||||
|
||||
// Parse the arguments
|
||||
remaining_args := fp.finalize() or {
|
||||
eprintln('Error parsing arguments: ${err}')
|
||||
println(fp.usage())
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if help_requested {
|
||||
println(fp.usage())
|
||||
exit(0)
|
||||
}
|
||||
|
||||
mut r := &runner.Runner{
|
||||
name: runner_name
|
||||
namespace: namespace
|
||||
redis_conn: redisclient.new(
|
||||
if redis_url.len > 0 {
|
||||
redis_url
|
||||
} else {
|
||||
'127.0.0.1:6379'
|
||||
}
|
||||
)!
|
||||
}
|
||||
|
||||
spawn r.run()
|
||||
|
||||
for {}
|
Reference in New Issue
Block a user