refactor(console): renamed stuff to 'targets'

dev
Jef Roosens 2022-06-14 20:38:20 +02:00 committed by Jef Roosens
parent 4d581da7bf
commit faec08f846
Signed by untrusted user: Jef Roosens
GPG Key ID: B580B976584B5F30
3 changed files with 14 additions and 14 deletions

View File

@ -1,11 +1,11 @@
module git module targets
import client import client
import docker import docker
import os import os
import build import build
// build builds every Git repo in the server's list. // build locally builds the target with the given id.
fn build(conf Config, repo_id int) ? { fn build(conf Config, repo_id int) ? {
c := client.new(conf.address, conf.api_key) c := client.new(conf.address, conf.api_key)
repo := c.get_target(repo_id)? repo := c.get_target(repo_id)?

View File

@ -1,4 +1,4 @@
module git module targets
import cli import cli
import vieter.vconf import vieter.vconf
@ -16,12 +16,12 @@ struct Config {
// cmd returns the cli submodule that handles the repos API interaction // cmd returns the cli submodule that handles the repos API interaction
pub fn cmd() cli.Command { pub fn cmd() cli.Command {
return cli.Command{ return cli.Command{
name: 'repos' name: 'targets'
description: 'Interact with the repos API.' description: 'Interact with the targets API.'
commands: [ commands: [
cli.Command{ cli.Command{
name: 'list' name: 'list'
description: 'List the current repos.' description: 'List the current targets.'
flags: [ flags: [
cli.Flag{ cli.Flag{
name: 'limit' name: 'limit'
@ -35,7 +35,7 @@ pub fn cmd() cli.Command {
}, },
cli.Flag{ cli.Flag{
name: 'repo' name: 'repo'
description: 'Only return Git repos that publish to this repo.' description: 'Only return targets that publish to this repo.'
flag: cli.FlagType.string flag: cli.FlagType.string
}, },
] ]
@ -67,7 +67,7 @@ pub fn cmd() cli.Command {
name: 'add' name: 'add'
required_args: 3 required_args: 3
usage: 'url branch repo' usage: 'url branch repo'
description: 'Add a new repository.' description: 'Add a new Git repository target.'
execute: fn (cmd cli.Command) ? { execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')? 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)?
@ -79,7 +79,7 @@ pub fn cmd() cli.Command {
name: 'remove' name: 'remove'
required_args: 1 required_args: 1
usage: 'id' usage: 'id'
description: 'Remove a repository that matches the given ID prefix.' description: 'Remove a target that matches the given id.'
execute: fn (cmd cli.Command) ? { execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')? 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)?
@ -91,7 +91,7 @@ pub fn cmd() cli.Command {
name: 'info' name: 'info'
required_args: 1 required_args: 1
usage: 'id' usage: 'id'
description: 'Show detailed information for the repo matching the ID prefix.' description: 'Show detailed information for the target matching the id.'
execute: fn (cmd cli.Command) ? { execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')? 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)?
@ -103,7 +103,7 @@ pub fn cmd() cli.Command {
name: 'edit' name: 'edit'
required_args: 1 required_args: 1
usage: 'id' usage: 'id'
description: 'Edit the repository that matches the given ID prefix.' description: 'Edit the Git repository target that matches the given id.'
flags: [ flags: [
cli.Flag{ cli.Flag{
name: 'url' name: 'url'
@ -152,7 +152,7 @@ pub fn cmd() cli.Command {
name: 'build' name: 'build'
required_args: 1 required_args: 1
usage: 'id' usage: 'id'
description: 'Build the repo with the given id & publish it.' description: 'Build the target with the given id & publish it.'
execute: fn (cmd cli.Command) ? { execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file')? 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)?

View File

@ -3,7 +3,7 @@ module main
import os import os
import server import server
import cli import cli
import console.git import console.targets
import console.logs import console.logs
import console.schedule import console.schedule
import console.man import console.man
@ -26,7 +26,7 @@ fn main() {
] ]
commands: [ commands: [
server.cmd(), server.cmd(),
git.cmd(), targets.cmd(),
cron.cmd(), cron.cmd(),
logs.cmd(), logs.cmd(),
schedule.cmd(), schedule.cmd(),