Merge pull request #345 from djmitche/reexport-chrono
Re-export the chrono crate from taskchampion.
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -1528,7 +1528,6 @@ dependencies = [
|
|||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cc",
|
"cc",
|
||||||
"chrono",
|
|
||||||
"env_logger 0.8.4",
|
"env_logger 0.8.4",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
@@ -3007,7 +3006,6 @@ dependencies = [
|
|||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
"atty",
|
"atty",
|
||||||
"built",
|
"built",
|
||||||
"chrono",
|
|
||||||
"dialoguer",
|
"dialoguer",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"env_logger 0.8.4",
|
"env_logger 0.8.4",
|
||||||
@@ -3036,7 +3034,6 @@ name = "taskchampion-lib"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
|
||||||
"libc",
|
"libc",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"taskchampion",
|
"taskchampion",
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ toml = "^0.5.8"
|
|||||||
toml_edit = "^0.2.0"
|
toml_edit = "^0.2.0"
|
||||||
serde = { version = "^1.0.125", features = ["derive"] }
|
serde = { version = "^1.0.125", features = ["derive"] }
|
||||||
serde_json = "^1.0"
|
serde_json = "^1.0"
|
||||||
chrono = { version = "^0.4.10", features = ["serde"] }
|
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
iso8601-duration = "0.1"
|
iso8601-duration = "0.1"
|
||||||
dialoguer = "0.8"
|
dialoguer = "0.8"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use super::{any, timestamp};
|
use super::{any, timestamp};
|
||||||
use crate::argparse::NOW;
|
use crate::argparse::NOW;
|
||||||
use chrono::prelude::*;
|
|
||||||
use nom::bytes::complete::tag as nomtag;
|
use nom::bytes::complete::tag as nomtag;
|
||||||
use nom::{branch::*, character::complete::*, combinator::*, sequence::*, IResult};
|
use nom::{branch::*, character::complete::*, combinator::*, sequence::*, IResult};
|
||||||
|
use taskchampion::chrono::prelude::*;
|
||||||
use taskchampion::Status;
|
use taskchampion::Status;
|
||||||
|
|
||||||
/// Recognizes up to the colon of the common `<prefix>:...` syntax
|
/// 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 {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
use taskchampion::chrono::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_colon_prefix() {
|
fn test_colon_prefix() {
|
||||||
@@ -77,10 +78,10 @@ mod test {
|
|||||||
fn test_wait() {
|
fn test_wait() {
|
||||||
assert_eq!(wait_colon("wait:").unwrap(), ("", None));
|
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)));
|
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)));
|
assert_eq!(wait_colon("wait:1d2").unwrap(), ("2", Some(one_day)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use chrono::{prelude::*, Duration};
|
|
||||||
use iso8601_duration::Duration as IsoDuration;
|
use iso8601_duration::Duration as IsoDuration;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use nom::{
|
use nom::{
|
||||||
@@ -13,6 +12,7 @@ use nom::{
|
|||||||
Err, IResult,
|
Err, IResult,
|
||||||
};
|
};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use taskchampion::chrono::{self, prelude::*, Duration};
|
||||||
|
|
||||||
// https://taskwarrior.org/docs/dates.html
|
// https://taskwarrior.org/docs/dates.html
|
||||||
// https://taskwarrior.org/docs/named_dates.html
|
// https://taskwarrior.org/docs/named_dates.html
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ pub(crate) use modification::{DescriptionMod, Modification};
|
|||||||
pub(crate) use subcommand::Subcommand;
|
pub(crate) use subcommand::Subcommand;
|
||||||
|
|
||||||
use crate::usage::Usage;
|
use crate::usage::Usage;
|
||||||
use chrono::prelude::*;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
use taskchampion::chrono::prelude::*;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
// A static value of NOW to make tests easier
|
// A static value of NOW to make tests easier
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use super::args::{any, arg_matching, minus_tag, plus_tag, wait_colon};
|
use super::args::{any, arg_matching, minus_tag, plus_tag, wait_colon};
|
||||||
use super::ArgList;
|
use super::ArgList;
|
||||||
use crate::usage;
|
use crate::usage;
|
||||||
use chrono::prelude::*;
|
|
||||||
use nom::{branch::alt, combinator::*, multi::fold_many0, IResult};
|
use nom::{branch::alt, combinator::*, multi::fold_many0, IResult};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use taskchampion::chrono::prelude::*;
|
||||||
use taskchampion::{Status, Tag};
|
use taskchampion::{Status, Tag};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
@@ -169,6 +169,7 @@ mod test {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::argparse::NOW;
|
use crate::argparse::NOW;
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
use taskchampion::chrono::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
@@ -215,7 +216,7 @@ mod test {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
modification,
|
modification,
|
||||||
Modification {
|
Modification {
|
||||||
wait: Some(Some(*NOW + chrono::Duration::days(2))),
|
wait: Some(Some(*NOW + Duration::days(2))),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ fn import_task<W: WriteColor>(
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::invocation::test::*;
|
use crate::invocation::test::*;
|
||||||
use chrono::{TimeZone, Utc};
|
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
use taskchampion::chrono::{TimeZone, Utc};
|
||||||
use taskchampion::{Priority, Status};
|
use taskchampion::{Priority, Status};
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use anyhow::{anyhow, bail};
|
use anyhow::{anyhow, bail};
|
||||||
use chrono::{DateTime, TimeZone, Utc};
|
|
||||||
use serde::{self, Deserialize, Deserializer};
|
use serde::{self, Deserialize, Deserializer};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use taskchampion::chrono::{DateTime, TimeZone, Utc};
|
||||||
use taskchampion::{Replica, Uuid};
|
use taskchampion::{Replica, Uuid};
|
||||||
use termcolor::{Color, ColorSpec, WriteColor};
|
use termcolor::{Color, ColorSpec, WriteColor};
|
||||||
|
|
||||||
@@ -152,10 +152,10 @@ fn import_task<W: WriteColor>(
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::invocation::test::*;
|
use crate::invocation::test::*;
|
||||||
use chrono::{TimeZone, Utc};
|
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
use taskchampion::chrono::{TimeZone, Utc};
|
||||||
use taskchampion::{Priority, Status};
|
use taskchampion::{Priority, Status};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::argparse::{DescriptionMod, Modification};
|
use crate::argparse::{DescriptionMod, Modification};
|
||||||
use chrono::Utc;
|
use taskchampion::chrono::Utc;
|
||||||
use taskchampion::{Annotation, TaskMut};
|
use taskchampion::{Annotation, TaskMut};
|
||||||
|
|
||||||
/// Apply the given modification
|
/// Apply the given modification
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ mod test {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::invocation::test::*;
|
use crate::invocation::test::*;
|
||||||
use crate::settings::Sort;
|
use crate::settings::Sort;
|
||||||
use chrono::prelude::*;
|
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
use taskchampion::chrono::{prelude::*, Duration};
|
||||||
use taskchampion::{Status, Uuid};
|
use taskchampion::{Status, Uuid};
|
||||||
|
|
||||||
fn create_tasks(replica: &mut Replica) -> [Uuid; 3] {
|
fn create_tasks(replica: &mut Replica) -> [Uuid; 3] {
|
||||||
@@ -237,7 +237,7 @@ mod test {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_mut(&mut replica)
|
.into_mut(&mut replica)
|
||||||
.set_wait(Some(Utc::now() + chrono::Duration::days(2)))
|
.set_wait(Some(Utc::now() + Duration::days(2)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
replica
|
replica
|
||||||
@@ -245,7 +245,7 @@ mod test {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_mut(&mut replica)
|
.into_mut(&mut replica)
|
||||||
.set_wait(Some(Utc::now() + chrono::Duration::days(3)))
|
.set_wait(Some(Utc::now() + Duration::days(3)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let working_set = replica.working_set().unwrap();
|
let working_set = replica.working_set().unwrap();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ publish = false
|
|||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = { version = "^0.4.10", features = ["serde"] }
|
|
||||||
taskchampion = { path = "../taskchampion" }
|
taskchampion = { path = "../taskchampion" }
|
||||||
taskchampion-sync-server = { path = "../sync-server" }
|
taskchampion-sync-server = { path = "../sync-server" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use chrono::{TimeZone, Utc};
|
use taskchampion::chrono::{TimeZone, Utc};
|
||||||
use taskchampion::{Replica, ServerConfig, Status, StorageConfig};
|
use taskchampion::{Replica, ServerConfig, Status, StorageConfig};
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ crate-type = ["staticlib", "cdylib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.113"
|
libc = "0.2.113"
|
||||||
chrono = "^0.4.10"
|
|
||||||
taskchampion = { path = "../taskchampion" }
|
taskchampion = { path = "../taskchampion" }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use chrono::prelude::*;
|
use taskchampion::chrono::prelude::*;
|
||||||
|
|
||||||
/// TCAnnotation contains the details of an annotation.
|
/// TCAnnotation contains the details of an annotation.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Trait implementations for a few atomic types
|
//! Trait implementations for a few atomic types
|
||||||
|
|
||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
use chrono::prelude::*;
|
use taskchampion::chrono::prelude::*;
|
||||||
|
|
||||||
impl PassByValue for usize {
|
impl PassByValue for usize {
|
||||||
type RustType = usize;
|
type RustType = usize;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::util::err_to_ruststring;
|
use crate::util::err_to_ruststring;
|
||||||
use chrono::{TimeZone, Utc};
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use taskchampion::chrono::{TimeZone, Utc};
|
||||||
use taskchampion::{Annotation, Tag, Task, TaskMut};
|
use taskchampion::{Annotation, Tag, Task, TaskMut};
|
||||||
|
|
||||||
/// A task, as publicly exposed by this library.
|
/// A task, as publicly exposed by this library.
|
||||||
|
|||||||
@@ -63,3 +63,6 @@ pub use workingset::WorkingSet;
|
|||||||
|
|
||||||
/// Re-exported type from the `uuid` crate, for ease of compatibility for consumers of this crate.
|
/// Re-exported type from the `uuid` crate, for ease of compatibility for consumers of this crate.
|
||||||
pub use uuid::Uuid;
|
pub use uuid::Uuid;
|
||||||
|
|
||||||
|
/// Re-exported chrono module.
|
||||||
|
pub use chrono;
|
||||||
|
|||||||
Reference in New Issue
Block a user