chore: stop shadowing import names with variables

This commit is contained in:
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

@ -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)
}