allow to supress the warning about old database version
This commit is contained in:
parent
5dd87616f8
commit
615caab92a
14
src/old.rs
14
src/old.rs
|
@ -72,12 +72,14 @@ pub fn time_or_warning<D: Database>(time: DateTime<Utc>, db: &D) -> Result<(Date
|
|||
/// emits the appropiate warning if the old database format was detected.
|
||||
pub fn warn_if_needed<E: Write>(err: &mut E, needs_warning: bool) -> Result<()> {
|
||||
if needs_warning {
|
||||
writeln!(
|
||||
err,
|
||||
"{} You are using the old timetrap format, it is advised that \
|
||||
you update your database using t migrate",
|
||||
Yellow.bold().paint("[WARNING]"),
|
||||
).map_err(|e| IOError(e))?;
|
||||
if std::env::var_os("TIEMPO_SUPRESS_TIMETRAP_WARNING").is_none() {
|
||||
writeln!(
|
||||
err,
|
||||
"{} You are using the old timetrap format, it is advised that \
|
||||
you update your database using t migrate",
|
||||
Yellow.bold().paint("[WARNING]"),
|
||||
).map_err(|e| IOError(e))?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue