refactor(client): streamline code & improve error propagation

This commit is contained in:
Jef Roosens 2022-12-15 10:01:45 +01:00
parent 0bd5158608
commit 0727d0fd25
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 29 additions and 67 deletions

View file

@ -183,15 +183,7 @@ 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)
logs := c.get_build_logs(filter)!.data
print_log_list(logs, raw)!
}
// list prints a list of all build logs for a given target.
fn list_for_target(conf Config, target_id int, raw bool) ! {
c := client.new(conf.address, conf.api_key)
logs := c.get_build_logs_for_target(target_id)!.data
logs := c.get_build_logs(filter)!
print_log_list(logs, raw)!
}
@ -199,7 +191,7 @@ fn list_for_target(conf Config, target_id int, raw bool) ! {
// 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)!
print(log)
}