chore: stop shadowing import names with variables

pull/347/head
Jef Roosens 2023-02-15 16:24:07 +01:00
parent bff817ccd9
commit 4dc82515f4
8 changed files with 52 additions and 57 deletions

View File

@ -23,9 +23,9 @@ pub fn cmd() cli.Command {
description: 'Start an agent daemon.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
agent(conf)!
agent(conf_)!
}
}
}

View File

@ -36,12 +36,12 @@ pub fn cmd() cli.Command {
required_args: 2
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
c := aur.new()
pkgs := c.info(cmd.args[1..])!
vc := client.new(conf.address, conf.api_key)
vc := client.new(conf_.address, conf_.api_key)
for pkg in pkgs {
vc.add_target(

View File

@ -74,7 +74,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
mut filter := BuildLogFilter{}
@ -146,7 +146,7 @@ pub fn cmd() cli.Command {
raw := cmd.flags.get_bool('raw')!
list(conf, filter, raw)!
list(conf_, filter, raw)!
}
},
cli.Command{
@ -156,9 +156,9 @@ pub fn cmd() cli.Command {
description: 'Remove a build log that matches the given id.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
remove(conf, cmd.args[0])!
remove(conf_, cmd.args[0])!
}
},
cli.Command{
@ -168,10 +168,10 @@ pub fn cmd() cli.Command {
description: 'Show all info for a specific build log.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
id := cmd.args[0].int()
info(conf, id)!
info(conf_, id)!
}
},
cli.Command{
@ -181,10 +181,10 @@ pub fn cmd() cli.Command {
description: 'Output the content of a build log to stdout.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
id := cmd.args[0].int()
content(conf, id)!
content(conf_, id)!
}
},
]
@ -204,16 +204,16 @@ fn print_log_list(logs []BuildLog, raw bool) ! {
}
// list prints a list of all build logs.
fn list(conf Config, filter BuildLogFilter, raw bool) ! {
c := client.new(conf.address, conf.api_key)
fn list(conf_ Config, filter BuildLogFilter, raw bool) ! {
c := client.new(conf_.address, conf_.api_key)
logs := c.get_build_logs(filter)!
print_log_list(logs, raw)!
}
// info print the detailed info for a given build log.
fn info(conf Config, id int) ! {
c := client.new(conf.address, conf.api_key)
fn info(conf_ Config, id int) ! {
c := client.new(conf_.address, conf_.api_key)
log := c.get_build_log(id)!
print(log)
@ -221,15 +221,15 @@ fn info(conf Config, id int) ! {
// content outputs the contents of the log file for a given build log to
// stdout.
fn content(conf Config, id int) ! {
c := client.new(conf.address, conf.api_key)
fn content(conf_ Config, id int) ! {
c := client.new(conf_.address, conf_.api_key)
content := c.get_build_log_content(id)!
println(content)
}
// remove removes a build log from the server's list.
fn remove(conf Config, id string) ! {
c := client.new(conf.address, conf.api_key)
fn remove(conf_ Config, id string) ! {
c := client.new(conf_.address, conf_.api_key)
c.remove_build_log(id.int())!
}

View File

@ -28,7 +28,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
if cmd.args.len < 3 {
if !cmd.flags.get_bool('force')! {
@ -36,14 +36,14 @@ pub fn cmd() cli.Command {
}
}
client := client.new(conf.address, conf.api_key)
client_ := client.new(conf_.address, conf_.api_key)
if cmd.args.len == 1 {
client.remove_repo(cmd.args[0])!
client_.remove_repo(cmd.args[0])!
} else if cmd.args.len == 2 {
client.remove_arch_repo(cmd.args[0], cmd.args[1])!
client_.remove_arch_repo(cmd.args[0], cmd.args[1])!
} else {
client.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])!
client_.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])!
}
}
},

View File

@ -54,7 +54,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
mut filter := TargetFilter{}
@ -85,7 +85,7 @@ pub fn cmd() cli.Command {
raw := cmd.flags.get_bool('raw')!
list(conf, filter, raw)!
list(conf_, filter, raw)!
}
},
cli.Command{
@ -113,7 +113,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
t := NewTarget{
kind: cmd.flags.get_string('kind')!
@ -125,7 +125,7 @@ pub fn cmd() cli.Command {
raw := cmd.flags.get_bool('raw')!
add(conf, t, raw)!
add(conf_, t, raw)!
}
},
cli.Command{
@ -135,9 +135,9 @@ pub fn cmd() cli.Command {
description: 'Remove a target that matches the given id.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
remove(conf, cmd.args[0])!
remove(conf_, cmd.args[0])!
}
},
cli.Command{
@ -147,9 +147,9 @@ pub fn cmd() cli.Command {
description: 'Show detailed information for the target matching the id.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
info(conf, cmd.args[0])!
info(conf_, cmd.args[0])!
}
},
cli.Command{
@ -196,7 +196,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
found := cmd.flags.get_all_found()
@ -208,7 +208,7 @@ pub fn cmd() cli.Command {
}
}
patch(conf, cmd.args[0], params)!
patch(conf_, cmd.args[0], params)!
}
},
cli.Command{
@ -235,7 +235,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
remote := cmd.flags.get_bool('remote')!
force := cmd.flags.get_bool('force')!
@ -248,10 +248,10 @@ pub fn cmd() cli.Command {
return error('When scheduling the build remotely, you have to specify an architecture.')
}
c := client.new(conf.address, conf.api_key)
c := client.new(conf_.address, conf_.api_key)
c.queue_job(target_id, arch, force)!
} else {
build(conf, target_id, force)!
build(conf_, target_id, force)!
}
}
},
@ -260,8 +260,8 @@ pub fn cmd() cli.Command {
}
// list prints out a list of all repositories.
fn list(conf Config, filter TargetFilter, raw bool) ! {
c := client.new(conf.address, conf.api_key)
fn list(conf_ Config, filter TargetFilter, raw bool) ! {
c := client.new(conf_.address, conf_.api_key)
targets := c.get_targets(filter)!
data := targets.map([it.id.str(), it.kind, it.url, it.repo])
@ -273,8 +273,8 @@ fn list(conf Config, filter TargetFilter, raw bool) ! {
}
// add adds a new target to the server's list.
fn add(conf Config, t &NewTarget, raw bool) ! {
c := client.new(conf.address, conf.api_key)
fn add(conf_ Config, t &NewTarget, raw bool) ! {
c := client.new(conf_.address, conf_.api_key)
target_id := c.add_target(t)!
if raw {
@ -285,13 +285,13 @@ fn add(conf Config, t &NewTarget, raw bool) ! {
}
// remove removes a target from the server's list.
fn remove(conf Config, id string) ! {
c := client.new(conf.address, conf.api_key)
fn remove(conf_ Config, id string) ! {
c := client.new(conf_.address, conf_.api_key)
c.remove_target(id.int())!
}
// patch patches a given target with the provided params.
fn patch(conf Config, id string, params map[string]string) ! {
fn patch(conf_ Config, id string, params map[string]string) ! {
// We check the cron expression first because it's useless to send an
// invalid one to the server.
if 'schedule' in params && params['schedule'] != '' {
@ -300,13 +300,13 @@ fn patch(conf Config, id string, params map[string]string) ! {
}
}
c := client.new(conf.address, conf.api_key)
c := client.new(conf_.address, conf_.api_key)
c.patch_target(id.int(), params)!
}
// info shows detailed information for a given target.
fn info(conf Config, id string) ! {
c := client.new(conf.address, conf.api_key)
fn info(conf_ Config, id string) ! {
c := client.new(conf_.address, conf_.api_key)
target := c.get_target(id.int())!
println(target)
}

View File

@ -1,5 +0,0 @@
// With V 0.3.3, Vieter fails to compile without this fix, as provided by
// spytheman. It will get fixed in V itself, but this temporary fix allows me
// to stay on V 0.3.3.
[typedef]
pub struct C.SSL_CTX{}

View File

@ -25,9 +25,9 @@ pub fn cmd() cli.Command {
description: 'Start the Vieter server.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
server(conf)!
server(conf_)!
}
}
}

View File

@ -82,7 +82,7 @@ pub fn server(conf Config) ! {
repo_dir := os.join_path_single(conf.data_dir, server.repo_dir_name)
// This also creates the directories if needed
repo := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or {
repo_ := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or {
logger.error(err.msg())
exit(1)
}
@ -105,7 +105,7 @@ pub fn server(conf Config) ! {
logger: logger
api_key: conf.api_key
conf: conf
repo: repo
repo: repo_
db: db
collector: collector
job_queue: build.new_job_queue(global_ce, conf.base_image)