#!/usr/bin/env perl

use strict;
use warnings;

use FindBin qw($Bin);
use lib "$Bin/../lib";
use App::epoch qw(parse_time format_time);

die <<END if $ARGV[0] && $ARGV[0] =~ m/-h(?:elp)?/;
$0: Fuzzy time conversion to localtime

Usage:
    $0 time [--] [format]

    `time` can be any string that Time::ParseDate accepts
    `format` can be any string that Time::Format::time_format accepts
END

my (@time,@format);
push @time, shift(@ARGV) while $ARGV[0] && $ARGV[0] ne '--';
shift @ARGV if defined $ARGV[0] && $ARGV[0] eq '--';
print format_time(parse_time(@time),@ARGV)."\n";
