#!/usr/bin/env perl
|
|
|
|
=pod
|
|
|
|
=head1 NAME
|
|
|
|
commandlog-log - show commandlog history
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
commandlog log
|
|
|
|
=head1 AUTHOR
|
|
|
|
Brennen Bearnes <bbearnes@gmail.com>
|
|
|
|
=cut
|
|
|
|
use warnings;
|
|
use strict;
|
|
use 5.10.0;
|
|
use Cwd;
|
|
use DBI;
|
|
use Sys::Hostname;
|
|
use App::CommandLog;
|
|
|
|
my $dbfile = $ENV{HOME} . "/cli.db";
|
|
my $dbh = App::CommandLog::get_dbh($dbfile);
|
|
|
|
my $sth = $dbh->prepare(q{
|
|
SELECT * FROM commands ORDER BY datetime DESC LIMIT 10
|
|
});
|
|
|
|
$sth->execute();
|
|
|
|
while (my $data = $sth->fetchrow_hashref()) {
|
|
say join "\t", $data->{datetime}, $data->{command};
|
|
}
|
|
|
|
$sth->execute();
|
|
|
|
|