diff --git a/src/cron/cli.v b/src/cron/cli.v new file mode 100644 index 00000000..cbf5b882 --- /dev/null +++ b/src/cron/cli.v @@ -0,0 +1,26 @@ +module cron + +import cli +import env + +struct Config { +pub: + log_level string = 'WARN' + log_file string = 'vieter.log' + api_key string + address string + base_image string = 'archlinux:base-devel' +} + +pub fn cmd() cli.Command { + return cli.Command{ + name: 'cron' + description: 'Start the cron service that periodically runs builds.' + execute: fn (cmd cli.Command) ? { + config_file := cmd.flags.get_string('config-file') ? + conf := env.load(config_file) ? + + cron(conf) ? + } + } +} diff --git a/src/cron/cron.v b/src/cron/cron.v new file mode 100644 index 00000000..ac584eb9 --- /dev/null +++ b/src/cron/cron.v @@ -0,0 +1,7 @@ +module cron + +import git + +pub fn cron(conf Config) ? { + repos_map := git.get_repos(conf.address, conf.api_key) ? +} diff --git a/src/main.v b/src/main.v index c77e5519..adaf4dcf 100644 --- a/src/main.v +++ b/src/main.v @@ -5,6 +5,7 @@ import server import cli import build import git +import cron fn main() { mut app := cli.Command{ @@ -25,6 +26,7 @@ fn main() { server.cmd(), build.cmd(), git.cmd(), + cron.cmd() ] }