refactor: apply new vfmt defaults

This commit is contained in:
Jef Roosens 2022-05-14 20:06:08 +02:00
parent 53f5b68d08
commit 5f21e256ee
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
24 changed files with 138 additions and 138 deletions

View file

@ -20,10 +20,10 @@ pub fn cmd() cli.Command {
name: 'list'
description: 'List the current repos.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
list(conf) ?
list(conf)?
}
},
cli.Command{
@ -32,10 +32,10 @@ pub fn cmd() cli.Command {
usage: 'url branch repo'
description: 'Add a new repository.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
add(conf, cmd.args[0], cmd.args[1], cmd.args[2]) ?
add(conf, cmd.args[0], cmd.args[1], cmd.args[2])?
}
},
cli.Command{
@ -44,10 +44,10 @@ pub fn cmd() cli.Command {
usage: 'id'
description: 'Remove a repository that matches the given ID prefix.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
remove(conf, cmd.args[0]) ?
remove(conf, cmd.args[0])?
}
},
cli.Command{
@ -56,10 +56,10 @@ pub fn cmd() cli.Command {
usage: 'id'
description: 'Show detailed information for the repo matching the ID prefix.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
info(conf, cmd.args[0]) ?
info(conf, cmd.args[0])?
}
},
cli.Command{
@ -95,8 +95,8 @@ pub fn cmd() cli.Command {
},
]
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
found := cmd.flags.get_all_found()
@ -104,11 +104,11 @@ pub fn cmd() cli.Command {
for f in found {
if f.name != 'config-file' {
params[f.name] = f.get_string() ?
params[f.name] = f.get_string()?
}
}
patch(conf, cmd.args[0], params) ?
patch(conf, cmd.args[0], params)?
}
},
]
@ -121,7 +121,7 @@ pub fn cmd() cli.Command {
// list prints out a list of all repositories.
fn list(conf Config) ? {
c := client.new(conf.address, conf.api_key)
repos := c.get_git_repos() ?
repos := c.get_git_repos()?
for repo in repos {
println('$repo.id\t$repo.url\t$repo.branch\t$repo.repo')
@ -131,7 +131,7 @@ fn list(conf Config) ? {
// add adds a new repository to the server's list.
fn add(conf Config, url string, branch string, repo string) ? {
c := client.new(conf.address, conf.api_key)
res := c.add_git_repo(url, branch, repo, []) ?
res := c.add_git_repo(url, branch, repo, [])?
println(res.message)
}
@ -143,7 +143,7 @@ fn remove(conf Config, id string) ? {
if id_int != 0 {
c := client.new(conf.address, conf.api_key)
res := c.remove_git_repo(id_int) ?
res := c.remove_git_repo(id_int)?
println(res.message)
}
}
@ -161,7 +161,7 @@ fn patch(conf Config, id string, params map[string]string) ? {
id_int := id.int()
if id_int != 0 {
c := client.new(conf.address, conf.api_key)
res := c.patch_git_repo(id_int, params) ?
res := c.patch_git_repo(id_int, params)?
println(res.message)
}
@ -176,6 +176,6 @@ fn info(conf Config, id string) ? {
}
c := client.new(conf.address, conf.api_key)
repo := c.get_git_repo(id_int) ?
repo := c.get_git_repo(id_int)?
println(repo)
}

View file

@ -27,12 +27,12 @@ pub fn cmd() cli.Command {
},
]
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
repo_id := cmd.flags.get_int('repo') ?
repo_id := cmd.flags.get_int('repo')?
if repo_id == 0 { list(conf) ? } else { list_for_repo(conf, repo_id) ? }
if repo_id == 0 { list(conf)? } else { list_for_repo(conf, repo_id)? }
}
},
cli.Command{
@ -41,11 +41,11 @@ pub fn cmd() cli.Command {
usage: 'id'
description: 'Show all info for a specific build log.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
id := cmd.args[0].int()
info(conf, id) ?
info(conf, id)?
}
},
cli.Command{
@ -54,11 +54,11 @@ pub fn cmd() cli.Command {
usage: 'id'
description: 'Output the content of a build log to stdout.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<Config>(config_file) ?
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
id := cmd.args[0].int()
content(conf, id) ?
content(conf, id)?
}
},
]
@ -75,7 +75,7 @@ fn print_log_list(logs []db.BuildLog) {
// list prints a list of all build logs.
fn list(conf Config) ? {
c := client.new(conf.address, conf.api_key)
logs := c.get_build_logs() ?.data
logs := c.get_build_logs()?.data
print_log_list(logs)
}
@ -83,7 +83,7 @@ fn list(conf Config) ? {
// list prints a list of all build logs for a given repo.
fn list_for_repo(conf Config, repo_id int) ? {
c := client.new(conf.address, conf.api_key)
logs := c.get_build_logs_for_repo(repo_id) ?.data
logs := c.get_build_logs_for_repo(repo_id)?.data
print_log_list(logs)
}
@ -91,7 +91,7 @@ fn list_for_repo(conf Config, repo_id int) ? {
// info print the detailed info for a given build log.
fn info(conf Config, id int) ? {
c := client.new(conf.address, conf.api_key)
log := c.get_build_log(id) ?.data
log := c.get_build_log(id)?.data
print(log)
}
@ -100,7 +100,7 @@ fn info(conf Config, id int) ? {
// stdout.
fn content(conf Config, id int) ? {
c := client.new(conf.address, conf.api_key)
content := c.get_build_log_content(id) ?
content := c.get_build_log_content(id)?
println(content)
}