summaryrefslogtreecommitdiffstats
path: root/bin/ttyrec
blob: c4d46d917440973e0e33470aa30dda435a382b6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env perl
use strict;
use warnings;

use App::Ttyrec;
use Getopt::Long;

my $cmd = $ENV{SHELL} || '/bin/sh';
my $append;

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);