diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-02-25 03:29:50 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-02-25 03:29:50 -0600 |
commit | 077f578b9674ec9e8b9fa38b8384b2bcad12236b (patch) | |
tree | 7c4942de7c3870a8bde203e9727c39429835c3fe /bin | |
parent | 1bae19872cfd13c2bbde42c1a4b7edec6cc443bb (diff) | |
download | app-ttyrec-077f578b9674ec9e8b9fa38b8384b2bcad12236b.tar.gz app-ttyrec-077f578b9674ec9e8b9fa38b8384b2bcad12236b.zip |
flesh out the ttyrec script
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ttyrec | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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); |