Command-line history logging utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
587 B

  1. #!/usr/bin/env perl
  2. =pod
  3. =head1 NAME
  4. commandlog-log - show commandlog history
  5. =head1 SYNOPSIS
  6. commandlog log
  7. =head1 AUTHOR
  8. Brennen Bearnes <bbearnes@gmail.com>
  9. =cut
  10. use warnings;
  11. use strict;
  12. use 5.10.0;
  13. use Cwd;
  14. use DBI;
  15. use Sys::Hostname;
  16. use App::CommandLog;
  17. my $dbfile = $ENV{HOME} . "/cli.db";
  18. my $dbh = App::CommandLog::get_dbh($dbfile);
  19. my $sth = $dbh->prepare(q{
  20. SELECT * FROM commands ORDER BY datetime DESC LIMIT 10
  21. });
  22. $sth->execute();
  23. while (my $data = $sth->fetchrow_hashref()) {
  24. say join "\t", $data->{datetime}, $data->{command};
  25. }
  26. $sth->execute();