Re-export the chrono crate from taskchampion.

The chrono types are central to use of TC, so this will help consumers
of the TC crate to avoid dependency conflicts.
This commit is contained in:
Dustin J. Mitchell
2022-03-12 20:12:39 +00:00
parent 9355e1a728
commit f8c4ece238
17 changed files with 23 additions and 24 deletions

View File

@@ -24,7 +24,6 @@ toml = "^0.5.8"
toml_edit = "^0.2.0"
serde = { version = "^1.0.125", features = ["derive"] }
serde_json = "^1.0"
chrono = { version = "^0.4.10", features = ["serde"] }
lazy_static = "1"
iso8601-duration = "0.1"
dialoguer = "0.8"

View File

@@ -1,8 +1,8 @@
use super::{any, timestamp};
use crate::argparse::NOW;
use chrono::prelude::*;
use nom::bytes::complete::tag as nomtag;
use nom::{branch::*, character::complete::*, combinator::*, sequence::*, IResult};
use taskchampion::chrono::prelude::*;
use taskchampion::Status;
/// Recognizes up to the colon of the common `<prefix>:...` syntax
@@ -52,6 +52,7 @@ pub(crate) fn wait_colon(input: &str) -> IResult<&str, Option<DateTime<Utc>>> {
mod test {
use super::*;
use pretty_assertions::assert_eq;
use taskchampion::chrono::Duration;
#[test]
fn test_colon_prefix() {
@@ -77,10 +78,10 @@ mod test {
fn test_wait() {
assert_eq!(wait_colon("wait:").unwrap(), ("", None));
let one_day = *NOW + chrono::Duration::days(1);
let one_day = *NOW + Duration::days(1);
assert_eq!(wait_colon("wait:1d").unwrap(), ("", Some(one_day)));
let one_day = *NOW + chrono::Duration::days(1);
let one_day = *NOW + Duration::days(1);
assert_eq!(wait_colon("wait:1d2").unwrap(), ("2", Some(one_day)));
}
}

View File

@@ -1,4 +1,3 @@
use chrono::{prelude::*, Duration};
use iso8601_duration::Duration as IsoDuration;
use lazy_static::lazy_static;
use nom::{
@@ -13,6 +12,7 @@ use nom::{
Err, IResult,
};
use std::str::FromStr;
use taskchampion::chrono::{self, prelude::*, Duration};
// https://taskwarrior.org/docs/dates.html
// https://taskwarrior.org/docs/named_dates.html

View File

@@ -31,8 +31,8 @@ pub(crate) use modification::{DescriptionMod, Modification};
pub(crate) use subcommand::Subcommand;
use crate::usage::Usage;
use chrono::prelude::*;
use lazy_static::lazy_static;
use taskchampion::chrono::prelude::*;
lazy_static! {
// A static value of NOW to make tests easier

View File

@@ -1,9 +1,9 @@
use super::args::{any, arg_matching, minus_tag, plus_tag, wait_colon};
use super::ArgList;
use crate::usage;
use chrono::prelude::*;
use nom::{branch::alt, combinator::*, multi::fold_many0, IResult};
use std::collections::HashSet;
use taskchampion::chrono::prelude::*;
use taskchampion::{Status, Tag};
#[derive(Debug, PartialEq, Clone)]
@@ -169,6 +169,7 @@ mod test {
use super::*;
use crate::argparse::NOW;
use pretty_assertions::assert_eq;
use taskchampion::chrono::Duration;
#[test]
fn test_empty() {
@@ -215,7 +216,7 @@ mod test {
assert_eq!(
modification,
Modification {
wait: Some(Some(*NOW + chrono::Duration::days(2))),
wait: Some(Some(*NOW + Duration::days(2))),
..Default::default()
}
);

View File

@@ -84,9 +84,9 @@ fn import_task<W: WriteColor>(
mod test {
use super::*;
use crate::invocation::test::*;
use chrono::{TimeZone, Utc};
use pretty_assertions::assert_eq;
use std::convert::TryInto;
use taskchampion::chrono::{TimeZone, Utc};
use taskchampion::{Priority, Status};
use tempfile::TempDir;

View File

@@ -1,8 +1,8 @@
use anyhow::{anyhow, bail};
use chrono::{DateTime, TimeZone, Utc};
use serde::{self, Deserialize, Deserializer};
use serde_json::Value;
use std::collections::HashMap;
use taskchampion::chrono::{DateTime, TimeZone, Utc};
use taskchampion::{Replica, Uuid};
use termcolor::{Color, ColorSpec, WriteColor};
@@ -152,10 +152,10 @@ fn import_task<W: WriteColor>(
mod test {
use super::*;
use crate::invocation::test::*;
use chrono::{TimeZone, Utc};
use pretty_assertions::assert_eq;
use serde_json::json;
use std::convert::TryInto;
use taskchampion::chrono::{TimeZone, Utc};
use taskchampion::{Priority, Status};
#[test]

View File

@@ -1,5 +1,5 @@
use crate::argparse::{DescriptionMod, Modification};
use chrono::Utc;
use taskchampion::chrono::Utc;
use taskchampion::{Annotation, TaskMut};
/// Apply the given modification

View File

@@ -132,9 +132,9 @@ mod test {
use super::*;
use crate::invocation::test::*;
use crate::settings::Sort;
use chrono::prelude::*;
use pretty_assertions::assert_eq;
use std::convert::TryInto;
use taskchampion::chrono::{prelude::*, Duration};
use taskchampion::{Status, Uuid};
fn create_tasks(replica: &mut Replica) -> [Uuid; 3] {
@@ -237,7 +237,7 @@ mod test {
.unwrap()
.unwrap()
.into_mut(&mut replica)
.set_wait(Some(Utc::now() + chrono::Duration::days(2)))
.set_wait(Some(Utc::now() + Duration::days(2)))
.unwrap();
replica
@@ -245,7 +245,7 @@ mod test {
.unwrap()
.unwrap()
.into_mut(&mut replica)
.set_wait(Some(Utc::now() + chrono::Duration::days(3)))
.set_wait(Some(Utc::now() + Duration::days(3)))
.unwrap();
let working_set = replica.working_set().unwrap();