rename alert_logger -> alerter. cli colors

This commit is contained in:
mbecker20
2024-05-12 11:59:49 -07:00
parent 4ef095fe55
commit 17b2e6660c
13 changed files with 26 additions and 83 deletions

View File

@@ -1,6 +1,6 @@
# Monitor CLI
Monitor CLI is a command line tool to sync monitor resources and execute file defined procedures.
Monitor CLI is a tool to sync monitor resources and execute file defined procedures.
## Usage

View File

@@ -34,4 +34,4 @@ command = ""
[repo.config.on_pull]
path = "."
command = "/root/.cargo/bin/cargo build -p monitor_periphery --release"
command = "/root/.cargo/bin/cargo build -p monitor_periphery --release && cp ./target/release/periphery /home/ubuntu/periphery"

View File

@@ -79,7 +79,7 @@ async fn main() -> anyhow::Result<()> {
let version =
monitor_client().read(read::GetVersion {}).await?.version;
info!("monitor version: {version}");
info!("monitor version: {}", version.to_string().blue().bold());
match &cli_args().command {
Command::Exec { path } => execution::run_execution(path).await?,

View File

@@ -1,5 +1,6 @@
use std::path::Path;
use colored::Colorize;
use monitor_client::entities::{
alerter::Alerter, build::Build, builder::Builder,
deployment::Deployment, procedure::Procedure, repo::Repo,
@@ -13,7 +14,10 @@ mod resources;
mod user_group;
pub async fn run_sync(path: &Path) -> anyhow::Result<()> {
info!("path: {path:?}");
info!(
"resources path: {}",
path.display().to_string().blue().bold()
);
let resources = resource_file::read_resources(path)?;
@@ -57,7 +61,7 @@ pub async fn run_sync(path: &Path) -> anyhow::Result<()> {
&& user_group_creates.is_empty()
&& user_group_updates.is_empty()
{
info!("nothing to do. exiting.");
info!("{}. exiting.", "nothing to do".green().bold());
return Ok(());
}

View File

@@ -1,6 +1,7 @@
use std::{fs, path::Path};
use anyhow::{anyhow, Context};
use colored::Colorize;
use monitor_client::entities::toml::ResourcesToml;
pub fn read_resources(path: &Path) -> anyhow::Result<ResourcesToml> {
@@ -30,7 +31,11 @@ fn read_resources_recursive(
return Ok(());
}
};
info!("adding resources from {path:?}");
info!(
"{} from {}",
"adding resources".green(),
path.display().to_string().blue().bold()
);
resources.server_templates.extend(more.server_templates);
resources.servers.extend(more.servers);
resources.builds.extend(more.builds);