Skip to content

Commit

Permalink
release v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Feb 3, 2024
1 parent 3341e53 commit 3725961
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "comodoro"
description = "CLI to manage personal time"
version = "0.1.1"
version = "0.1.2"
authors = ["soywod <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
12 changes: 9 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
7 changes: 2 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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};

Check warning on line 5 in src/main.rs

View workflow job for this annotation

GitHub Actions / deploy-windows-release

unused imports: `debug`, `warn`

Expand All @@ -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
}

0 comments on commit 3725961

Please sign in to comment.