summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-02-25 03:29:50 -0600
committerJesse Luehrs <doy@tozt.net>2012-02-25 03:29:50 -0600
commit077f578b9674ec9e8b9fa38b8384b2bcad12236b (patch)
tree7c4942de7c3870a8bde203e9727c39429835c3fe
parent1bae19872cfd13c2bbde42c1a4b7edec6cc443bb (diff)
downloadapp-ttyrec-077f578b9674ec9e8b9fa38b8384b2bcad12236b.tar.gz
app-ttyrec-077f578b9674ec9e8b9fa38b8384b2bcad12236b.zip
flesh out the ttyrec script
-rw-r--r--bin/ttyrec29
1 files changed, 26 insertions, 3 deletions
diff --git a/bin/ttyrec b/bin/ttyrec
index aa9b966..c4d46d9 100644
--- a/bin/ttyrec
+++ b/bin/ttyrec
@@ -3,8 +3,31 @@ use strict;
use warnings;
use App::Ttyrec;
+use Getopt::Long;
-@ARGV = ($ENV{SHELL} || '/bin/sh')
- unless @ARGV;
+my $cmd = $ENV{SHELL} || '/bin/sh';
+my $append;
-App::Ttyrec->new->run(@ARGV);
+sub usage {
+ my ($exit) = @_;
+
+ my $out = $exit ? \*STDERR : \*STDOUT;
+
+ print { $out }
+ "$0 [-a] [-e <cmd>] [output_file]\n";
+
+ exit($exit);
+}
+
+GetOptions(
+ 'execute=s' => \$cmd,
+ 'append' => \$append,
+ 'uudecode' => sub { die "uudecode mode not supported. "
+ . "Why are you not just using scp?\n" },
+ 'help' => sub { usage(0) },
+) || usage(1);
+
+App::Ttyrec->new(
+ ttyrec_file => ($ARGV[0] || 'ttyrecord'),
+ append => $append,
+)->run($cmd);