Skip to content

Commit 5cbe7a0

Browse files
committed
Remove "seen" command
Its functionality can be imitated via a combination of --if nick --exactly ... and tail, with more flexibility, though a little less performant.
1 parent 5864616 commit 5cbe7a0

File tree

3 files changed

+0
-50
lines changed

3 files changed

+0
-50
lines changed

cli/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,6 @@ pub fn main(cli: Cli) {
155155
.subcommand(SubCommand::with_name("stats")
156156
.about("Analyse the activity of users by certain metrics")
157157
.setting(AppSettings::AllowLeadingHyphen))
158-
.subcommand(SubCommand::with_name("seen")
159-
.about("Print the last line a nick was active")
160-
.setting(AppSettings::AllowLeadingHyphen)
161-
.arg(Arg::with_name("nick")
162-
.help("The nick you're looking for")
163-
.takes_value(true)
164-
.required(true)
165-
.index(1)))
166158
.subcommand(SubCommand::with_name("sort")
167159
.about("Sorts a log by time")
168160
.setting(AppSettings::AllowLeadingHyphen))
@@ -246,16 +238,6 @@ pub fn main(cli: Cli) {
246238

247239
stats::output_as_json(&args, &cli, stats)
248240
}
249-
("seen", Some(args)) => {
250-
let e = Environment(&args);
251-
let nick = args.value_of("nick").expect("Required argument <nick> not present");
252-
ilc_ops::seen::seen(nick,
253-
&e.context(),
254-
&mut e.input(),
255-
&mut *e.decoder(),
256-
&mut *e.output(),
257-
&Weechat)
258-
}
259241
("sort", Some(args)) => {
260242
let e = Environment(&args);
261243
ilc_ops::sort::sort(&e.context(),

ops/src/lib.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,6 @@ pub mod parse {
2929
}
3030
}
3131

32-
/// Last-seen of nicks
33-
pub mod seen {
34-
use ilc_base::{self, Context, Decode, Encode, Event};
35-
use std::io::{BufRead, Write};
36-
37-
/// Return the last message of a given nickname, searching from the beginning of the logs.
38-
/// Will return `Err` if the decoder yields `Err`. This relies on absolute timestamps, and
39-
/// behaviour without full dates is undefined.
40-
pub fn seen(nick: &str,
41-
ctx: &Context,
42-
input: &mut BufRead,
43-
decoder: &mut Decode,
44-
output: &mut Write,
45-
encoder: &Encode)
46-
-> ilc_base::Result<()> {
47-
let mut last: Option<Event> = None;
48-
for e in decoder.decode(&ctx, input) {
49-
let m: Event = try!(e);
50-
if m.ty.involves(nick) &&
51-
last.as_ref().map_or(true,
52-
|last| m.time.as_timestamp() > last.time.as_timestamp()) {
53-
last = Some(m)
54-
}
55-
}
56-
if let Some(ref m) = last {
57-
try!(encoder.encode(&ctx, output, m));
58-
}
59-
Ok(())
60-
}
61-
}
62-
6332
/// Internal (as opposed to external, not to be confused with private) log sorting
6433
pub mod sort {
6534
use ilc_base::{self, Context, Decode, Encode, Event};

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub use ilc_ops::convert::{self, convert};
1212
pub use ilc_ops::dedup::{self, dedup};
1313
pub use ilc_ops::stats::{self, stats};
1414
pub use ilc_ops::parse::{self, parse};
15-
pub use ilc_ops::seen::{self, seen};
1615
pub use ilc_ops::sort::{self, sort};
1716
pub use ilc_ops::merge::{self, merge};
1817

0 commit comments

Comments
 (0)