From faec08f846492718a5fefdb5d0d234bc5928e70c Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Tue, 14 Jun 2022 20:38:20 +0200 Subject: [PATCH] refactor(console): renamed stuff to 'targets' --- src/console/{git => targets}/build.v | 4 ++-- src/console/{git/git.v => targets/targets.v} | 20 ++++++++++---------- src/main.v | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) rename src/console/{git => targets}/build.v (90%) rename src/console/{git/git.v => targets/targets.v} (91%) diff --git a/src/console/git/build.v b/src/console/targets/build.v similarity index 90% rename from src/console/git/build.v rename to src/console/targets/build.v index b3c46a18..d50dfd2c 100644 --- a/src/console/git/build.v +++ b/src/console/targets/build.v @@ -1,11 +1,11 @@ -module git +module targets import client import docker import os 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) ? { c := client.new(conf.address, conf.api_key) repo := c.get_target(repo_id)? diff --git a/src/console/git/git.v b/src/console/targets/targets.v similarity index 91% rename from src/console/git/git.v rename to src/console/targets/targets.v index 6a4b9a87..9917913c 100644 --- a/src/console/git/git.v +++ b/src/console/targets/targets.v @@ -1,4 +1,4 @@ -module git +module targets import cli import vieter.vconf @@ -16,12 +16,12 @@ struct Config { // cmd returns the cli submodule that handles the repos API interaction pub fn cmd() cli.Command { return cli.Command{ - name: 'repos' - description: 'Interact with the repos API.' + name: 'targets' + description: 'Interact with the targets API.' commands: [ cli.Command{ name: 'list' - description: 'List the current repos.' + description: 'List the current targets.' flags: [ cli.Flag{ name: 'limit' @@ -35,7 +35,7 @@ pub fn cmd() cli.Command { }, cli.Flag{ 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 }, ] @@ -67,7 +67,7 @@ pub fn cmd() cli.Command { name: 'add' required_args: 3 usage: 'url branch repo' - description: 'Add a new repository.' + description: 'Add a new Git repository target.' execute: fn (cmd cli.Command) ? { config_file := cmd.flags.get_string('config-file')? conf := vconf.load(prefix: 'VIETER_', default_path: config_file)? @@ -79,7 +79,7 @@ pub fn cmd() cli.Command { name: 'remove' required_args: 1 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) ? { config_file := cmd.flags.get_string('config-file')? conf := vconf.load(prefix: 'VIETER_', default_path: config_file)? @@ -91,7 +91,7 @@ pub fn cmd() cli.Command { name: 'info' required_args: 1 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) ? { config_file := cmd.flags.get_string('config-file')? conf := vconf.load(prefix: 'VIETER_', default_path: config_file)? @@ -103,7 +103,7 @@ pub fn cmd() cli.Command { name: 'edit' required_args: 1 usage: 'id' - description: 'Edit the repository that matches the given ID prefix.' + description: 'Edit the Git repository target that matches the given id.' flags: [ cli.Flag{ name: 'url' @@ -152,7 +152,7 @@ pub fn cmd() cli.Command { name: 'build' required_args: 1 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) ? { config_file := cmd.flags.get_string('config-file')? conf := vconf.load(prefix: 'VIETER_', default_path: config_file)? diff --git a/src/main.v b/src/main.v index e1979de9..cba410ce 100644 --- a/src/main.v +++ b/src/main.v @@ -3,7 +3,7 @@ module main import os import server import cli -import console.git +import console.targets import console.logs import console.schedule import console.man @@ -26,7 +26,7 @@ fn main() { ] commands: [ server.cmd(), - git.cmd(), + targets.cmd(), cron.cmd(), logs.cmd(), schedule.cmd(),