blob: e7a878b429dca598ba077bb5955a07b9bba4da9e (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#!/usr/bin/env perl
use strict;
use warnings;
# ABSTRACT: record interactive terminal sessions
# PODNAME: ttyrec
use App::Ttyrec;
use Getopt::Long;
=head1 SYNOPSIS
ttyrec foo.ttyrec
ttyrec -e 'nethack' nethack.ttyrec
ttyrec -a
=head1 DESCRIPTION
This is an implementation of the C<ttyrec> program for recording terminal
sessions. All data that the program running in the terminal produces is
recorded, along with timing information, so that it can be replayed later (via
a ttyrec player such as the C<ttyplay> script distributed with
C<Term::TtyRec::Plus>).
This program is intended to be mostly a drop-in replacement for the C<ttyrec>
program distributed L<here|http://0xcc.net/ttyrec/index.html.en>.
=head1 OPTIONS
ttyrec [-a] [-e <cmd>] [output_file]
=over 4
=item -a
Append to the ttyrec file, rather than overwriting it.
=item -e <cmd>
Execute <cmd>, rather than a shell. Defaults to C<$SHELL> or C</bin/sh>.
=item output_file
The file to write the ttyrec data to. This can be a named pipe. Defaults to
C<ttyrecord>.
=back
=cut
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);
=head1 SEE ALSO
L<http://0xcc.net/ttyrec/index.html.en>
=cut
|