From 37259610c32c91cf488fd9bf1065b377d5274547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 3 Feb 2024 12:40:51 +0100 Subject: [PATCH] release v0.1.2 --- CHANGELOG.md | 6 ++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/cli.rs | 12 +++++++++--- src/main.rs | 7 ++----- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a090d6f..4885309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.2] - 2024-02-03 + +### Fixed + +- Prevented commands `manual` and `completion` to return an error when configuration file was not found. + ## [0.1.1] - 2024-02-03 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 35c73d9..a553551 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,7 +426,7 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comodoro" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 05d922e..ec36ab3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "comodoro" description = "CLI to manage personal time" -version = "0.1.1" +version = "0.1.2" authors = ["soywod "] edition = "2021" license = "MIT" diff --git a/src/cli.rs b/src/cli.rs index cc7b1f0..6815d0f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -53,12 +53,18 @@ pub enum ComodoroCommand { } impl ComodoroCommand { - pub async fn execute(self, config: &TomlConfig) -> Result<()> { + pub async fn execute(self, config_path: Option<&PathBuf>) -> Result<()> { match self { #[cfg(feature = "client")] - Self::Timer(cmd) => cmd.execute(config).await, + Self::Timer(cmd) => { + let config = TomlConfig::from_some_path_or_default(config_path).await?; + cmd.execute(&config).await + } #[cfg(feature = "server")] - Self::Server(cmd) => cmd.execute(config).await, + Self::Server(cmd) => { + let config = TomlConfig::from_some_path_or_default(config_path).await?; + cmd.execute(&config).await + } Self::Manual(cmd) => cmd.execute().await, Self::Completion(cmd) => cmd.execute().await, } diff --git a/src/main.rs b/src/main.rs index 4782184..4efe4ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use anyhow::Result; use clap::Parser; -use comodoro::{cli::Cli, config::TomlConfig}; +use comodoro::cli::Cli; use env_logger::{Builder as LoggerBuilder, Env, DEFAULT_FILTER_ENV}; use log::{debug, warn}; @@ -18,9 +18,6 @@ async fn main() -> Result<()> { .init(); let cli = Cli::parse(); - let config = TomlConfig::from_some_path_or_default(cli.config_path.as_ref()).await?; - cli.command.execute(&config).await?; - - Ok(()) + cli.command.execute(cli.config_path.as_ref()).await }