diff options
author | Till Höppner | 2016-03-16 17:17:25 +0100 |
---|---|---|
committer | Till Höppner | 2016-03-16 17:17:25 +0100 |
commit | 155971b36c100c0c146492375d5580ef0c5ac572 (patch) | |
tree | a7420ae7fbd123d3db4985621d9da5568da138e6 /cli/src/lib.rs | |
parent | 51c7e0c58d8aeaf342cb416c4376b69bd144c818 (diff) | |
download | ilc-155971b36c100c0c146492375d5580ef0c5ac572.tar.gz ilc-155971b36c100c0c146492375d5580ef0c5ac572.tar.xz ilc-155971b36c100c0c146492375d5580ef0c5ac572.zip |
Add time_out param, change timezone handling
Diffstat (limited to 'cli/src/lib.rs')
-rw-r--r-- | cli/src/lib.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cli/src/lib.rs b/cli/src/lib.rs index f4cc077..79953e4 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -64,11 +64,16 @@ pub fn main(cli: Cli) { .author("Till Höppner <till@hoeppner.ws>") .about("A converter and statistics utility for IRC log files") .arg(Arg::with_name("time") - .help("Timestamp offset, in seconds") + .help("Timestamp offset of input events, in seconds") .global(true) .takes_value(true) - .long("timeoffset") + .long("time_in") .short("t")) + .arg(Arg::with_name("time_out") + .help("Timestamp offset for output events, in seconds") + .global(true) + .takes_value(true) + .long("time_out")) .arg(Arg::with_name("date") .help("Override the date for this log, ISO 8601, YYYY-MM-DD") .global(true) @@ -390,9 +395,12 @@ impl<'a> Environment<'a> { pub fn build_context(args: &ArgMatches) -> Context { let mut context = Context { - timezone: FixedOffset::west(args.value_of("time") - .and_then(|s| s.parse::<i32>().ok()) - .unwrap_or(0)), + timezone_in: FixedOffset::east(args.value_of("time") + .and_then(|s| s.parse::<i32>().ok()) + .unwrap_or(0)), + timezone_out: FixedOffset::east(args.value_of("time_out") + .and_then(|s| s.parse::<i32>().ok()) + .unwrap_or(0)), override_date: args.value_of("date").and_then(|d| NaiveDate::from_str(&d).ok()), channel: args.value_of("channel").map(str::to_owned).clone(), }; |