From 077f578b9674ec9e8b9fa38b8384b2bcad12236b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 25 Feb 2012 03:29:50 -0600 Subject: flesh out the ttyrec script --- bin/ttyrec | 29 ++++++++++++++++++++++++++--- 1 file 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 ] [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); -- cgit v1.2.3-54-g00ecf