diff options
-rw-r--r-- | cli/src/lib.rs | 18 | ||||
-rw-r--r-- | ops/src/lib.rs | 31 | ||||
-rw-r--r-- | src/lib.rs | 1 |
3 files changed, 0 insertions, 50 deletions
diff --git a/cli/src/lib.rs b/cli/src/lib.rs index ac31636..f4cc077 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -155,14 +155,6 @@ pub fn main(cli: Cli) { .subcommand(SubCommand::with_name("stats") .about("Analyse the activity of users by certain metrics") .setting(AppSettings::AllowLeadingHyphen)) - .subcommand(SubCommand::with_name("seen") - .about("Print the last line a nick was active") - .setting(AppSettings::AllowLeadingHyphen) - .arg(Arg::with_name("nick") - .help("The nick you're looking for") - .takes_value(true) - .required(true) - .index(1))) .subcommand(SubCommand::with_name("sort") .about("Sorts a log by time") .setting(AppSettings::AllowLeadingHyphen)) @@ -246,16 +238,6 @@ pub fn main(cli: Cli) { stats::output_as_json(&args, &cli, stats) } - ("seen", Some(args)) => { - let e = Environment(&args); - let nick = args.value_of("nick").expect("Required argument <nick> not present"); - ilc_ops::seen::seen(nick, - &e.context(), - &mut e.input(), - &mut *e.decoder(), - &mut *e.output(), - &Weechat) - } ("sort", Some(args)) => { let e = Environment(&args); ilc_ops::sort::sort(&e.context(), diff --git a/ops/src/lib.rs b/ops/src/lib.rs index 6fd4cab..a929816 100644 --- a/ops/src/lib.rs +++ b/ops/src/lib.rs @@ -29,37 +29,6 @@ pub mod parse { } } -/// Last-seen of nicks -pub mod seen { - use ilc_base::{self, Context, Decode, Encode, Event}; - use std::io::{BufRead, Write}; - - /// Return the last message of a given nickname, searching from the beginning of the logs. - /// Will return `Err` if the decoder yields `Err`. This relies on absolute timestamps, and - /// behaviour without full dates is undefined. - pub fn seen(nick: &str, - ctx: &Context, - input: &mut BufRead, - decoder: &mut Decode, - output: &mut Write, - encoder: &Encode) - -> ilc_base::Result<()> { - let mut last: Option<Event> = None; - for e in decoder.decode(&ctx, input) { - let m: Event = try!(e); - if m.ty.involves(nick) && - last.as_ref().map_or(true, - |last| m.time.as_timestamp() > last.time.as_timestamp()) { - last = Some(m) - } - } - if let Some(ref m) = last { - try!(encoder.encode(&ctx, output, m)); - } - Ok(()) - } -} - /// Internal (as opposed to external, not to be confused with private) log sorting pub mod sort { use ilc_base::{self, Context, Decode, Encode, Event}; @@ -12,7 +12,6 @@ pub use ilc_ops::convert::{self, convert}; pub use ilc_ops::dedup::{self, dedup}; pub use ilc_ops::stats::{self, stats}; pub use ilc_ops::parse::{self, parse}; -pub use ilc_ops::seen::{self, seen}; pub use ilc_ops::sort::{self, sort}; pub use ilc_ops::merge::{self, merge}; |