mcfly 0.9.4

McFly replaces your default ctrl-r shell history search with an intelligent search engine that takes into account your working directory and the context of recently executed commands. McFly's suggestions are prioritized in real time with a small neural network.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use chrono::{DateTime, Local, TimeZone};

#[must_use]
pub fn parse_timestamp(s: &str) -> i64 {
    chrono_systemd_time::parse_timestamp_tz(s, Local)
        .unwrap_or_else(|err| panic!("McFly error: Failed to parse timestamp ({err})"))
        .latest()
        .timestamp()
}

#[inline]
#[must_use]
pub fn to_datetime(timestamp: i64) -> String {
    let utc = DateTime::from_timestamp(timestamp, 0).unwrap();
    Local.from_utc_datetime(&utc.naive_utc()).to_rfc3339()
}