Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

other: fix humantime-related documentation, add tests, support numbers + strings in toml #1220

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
give more human times on error
  • Loading branch information
ClementTsang committed Jun 21, 2023
commit 036c96eb4b05e1c8434c877e4bd7f8abfd7e63eb
12 changes: 6 additions & 6 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,12 @@ fn get_default_time_value(

if default_time < 30000 {
return Err(BottomError::ConfigError(
"set your default value to be at least 30000 milliseconds.".to_string(),
"set your default value to be at least 30s.".to_string(),
));
} else if default_time > retention_ms {
return Err(BottomError::ConfigError(format!(
"set your default value to be at most {} milliseconds.",
retention_ms
"set your default value to be at most {}.",
humantime::Duration::from(Duration::from_millis(retention_ms))
)));
}

Expand All @@ -679,12 +679,12 @@ fn get_time_interval(

if time_interval < 1000 {
return Err(BottomError::ConfigError(
"set your time delta to be at least 1000 milliseconds.".to_string(),
"set your time delta to be at least 1s.".to_string(),
));
} else if time_interval > retention_ms {
return Err(BottomError::ConfigError(format!(
"set your time delta to be at most {} milliseconds.",
retention_ms
"set your time delta to be at most {}.",
humantime::Duration::from(Duration::from_millis(retention_ms))
)));
}

Expand Down