refactor: migrated env code to own external module

This commit is contained in:
Jef Roosens 2022-06-15 13:20:29 +02:00
parent 4866cfa635
commit 44696fc11b
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
8 changed files with 24 additions and 124 deletions

View file

@ -1,7 +1,7 @@
module git
import cli
import env
import vieter.vconf
import cron.expression { parse_expression }
import client
import console
@ -41,7 +41,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
mut filter := GitRepoFilter{}
@ -70,7 +70,7 @@ pub fn cmd() cli.Command {
description: 'Add a new repository.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
add(conf, cmd.args[0], cmd.args[1], cmd.args[2])?
}
@ -82,7 +82,7 @@ pub fn cmd() cli.Command {
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)?
conf := vconf.load<Config>(default_path: config_file)?
remove(conf, cmd.args[0])?
}
@ -94,7 +94,7 @@ pub fn cmd() cli.Command {
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)?
conf := vconf.load<Config>(default_path: config_file)?
info(conf, cmd.args[0])?
}
@ -133,7 +133,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
found := cmd.flags.get_all_found()
@ -155,7 +155,7 @@ pub fn cmd() cli.Command {
description: 'Build the repo with the given id & publish it.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
build(conf, cmd.args[0].int())?
}

View file

@ -1,7 +1,7 @@
module logs
import cli
import env
import vieter.vconf
import client
import console
import time
@ -65,7 +65,7 @@ pub fn cmd() cli.Command {
]
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')?
conf := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
mut filter := BuildLogFilter{}
@ -143,7 +143,7 @@ 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 := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
id := cmd.args[0].int()
info(conf, id)?
@ -156,7 +156,7 @@ 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 := env.load<Config>(config_file)?
conf := vconf.load<Config>(default_path: config_file)?
id := cmd.args[0].int()
content(conf, id)?