mirror of
https://github.com/ovh/ovh-ttyrec.git
synced 2023-04-10 17:58:23 +03:00
rework the cmdline switches
-Z now means "compress if available" (with any available compression library) --zstd forces zstd and fails if not compiled-in --zstd-try is replaced by the semantics of -Z
This commit is contained in:
committed by
Stéphane Lesimple
parent
9c5116661f
commit
a989bc0c4c
@@ -1,12 +1,13 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
|
||||
.TH TTYREC "1" "June 2019" "ttyrec v1.1.6.0" "User Commands"
|
||||
.TH TTYREC "1" "June 2019" "ttyrec v1.1.5.0" "User Commands"
|
||||
.SH NAME
|
||||
ttyrec \- manual page for ttyrec v1.1.6.0
|
||||
ttyrec \- manual page for ttyrec v1.1.5.0
|
||||
.SH SYNOPSIS
|
||||
.B ttyrec
|
||||
[\fI\,options\/\fR] \fI\,-- <command> \/\fR[\fI\,command options\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Usage (legacy compatibility mode): ttyrec \fB\-e\fR <command> [options] [ttyrec file name]
|
||||
.TP
|
||||
legacy compatibility mode:
|
||||
.B ttyrec \fB\-e\fR <command> [options] [ttyrec file name]
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-z\fR, \fB\-\-uuid\fR UUID
|
||||
@@ -27,12 +28,12 @@ including the SIGUSR1 rotated ones
|
||||
\fB\-a\fR, \fB\-\-append\fR
|
||||
open the ttyrec output file in append mode instead of write\-clobber mode
|
||||
.TP
|
||||
\fB\-Z\fR, \fB\-\-zstd\fR
|
||||
enable on\-the\-fly compression of output file using zstd,
|
||||
the resulting file will have a '.ttyrec.zst' extension
|
||||
\fB\-Z\fR
|
||||
enable on\-the\-fly compression if available, silently fallback to no compression if not
|
||||
.TP
|
||||
\fB\-\-zstd\-try\fR
|
||||
enable on\-the\-fly zstd compression, silently fallback to no compression if not available
|
||||
\fB\-\-zstd\fR
|
||||
force on\-the\-fly compression of output file using zstd,
|
||||
the resulting file will have a '.ttyrec.zst' extension
|
||||
.TP
|
||||
\fB\-\-max\-flush\-time\fR S
|
||||
specify the maximum number of seconds after which we'll force zstd to flush its output buffers
|
||||
@@ -79,12 +80,22 @@ show version information
|
||||
\fB\-e\fR, \fB\-\-shell\-cmd\fR CMD
|
||||
enables legacy compatibility mode and specifies the command to be run under the user's $SHELL \fB\-c\fR
|
||||
.SH EXAMPLES
|
||||
.IP
|
||||
Run some shell commands in legacy mode: ttyrec \-e 'for i in a b c; do echo $i; done' outfile.ttyrec
|
||||
Run some shell commands in normal mode: ttyrec \-f /tmp/normal.ttyrec \-\- sh \-c 'for i in a b c; do echo $i; done'
|
||||
Connect to a remote machine interactively: ttyrec \-t 60 \-k 300 \-\- ssh remoteserver
|
||||
Execute a local script remotely with the default remote shell: ttyrec \-\- ssh remoteserver < script.sh
|
||||
Record a screen session: ttyrec screen
|
||||
.TP
|
||||
Run some shell commands in legacy mode:
|
||||
.B ttyrec \-e 'for i in a b c; do echo $i; done' outfile.ttyrec
|
||||
.TP
|
||||
Run some shell commands in normal mode:
|
||||
.B ttyrec \-f /tmp/normal.ttyrec \-\- sh \-c 'for i in a b c; do echo $i; done'
|
||||
.TP
|
||||
Connect to a remote machine interactively:
|
||||
.B ttyrec \-t 60 \-k 300 \-\- ssh remoteserver
|
||||
.TP
|
||||
Execute a local script remotely with the default remote shell:
|
||||
.B ttyrec \-\- ssh remoteserver < script.sh
|
||||
.TP
|
||||
Record a screen session:
|
||||
.B ttyrec screen
|
||||
.SH FOOTNOTES
|
||||
.SS "Handled signals:"
|
||||
.TP
|
||||
SIGUSR1
|
||||
@@ -106,7 +117,3 @@ kill your session
|
||||
.IP
|
||||
If we don't have a tty, we can't lock, so \-t will be ignored,
|
||||
whereas \-k will be applied without warning, as there's no tty to output a warning to.
|
||||
.PP
|
||||
uses: zstd[static] isastream cfmakeraw getpt posix_openpt grantpt openpty[pty.h] (Linux)
|
||||
compiler version 6.3.0 20170516 (gcc)
|
||||
libzstd version 10102 (1.1.2)
|
||||
|
||||
21
ttyrec.c
21
ttyrec.c
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{ "zstd", 0, 0, 'Z' },
|
||||
{ "zstd", 0, 0, 0 },
|
||||
{ "level", 1, 0, 'l' },
|
||||
{ "verbose", 0, 0, 'v' },
|
||||
{ "append", 0, 0, 'a' },
|
||||
@@ -292,7 +292,6 @@ int main(int argc, char **argv)
|
||||
{ "term", 1, 0, 'T' },
|
||||
{ "version", 0, 0, 'V' },
|
||||
{ "help", 0, 0, 'h' },
|
||||
{ "zstd-try", 0, 0, 0 },
|
||||
{ "max-flush-time", 1, 0, 0 },
|
||||
{ "name-format", 1, 0, 'F' },
|
||||
{ "warn-before-lock", 1, 0, 0 },
|
||||
@@ -312,12 +311,14 @@ int main(int argc, char **argv)
|
||||
{
|
||||
// long option without short-option counterpart
|
||||
case 0:
|
||||
if (strcmp(long_options[option_index].name, "zstd-try") == 0)
|
||||
if (strcmp(long_options[option_index].name, "zstd") == 0)
|
||||
{
|
||||
if (set_compress_mode(COMPRESS_ZSTD) == 0)
|
||||
if (set_compress_mode(COMPRESS_ZSTD) != 0)
|
||||
{
|
||||
opt_zstd++;
|
||||
fprintf(stderr, "zstd support has not been enabled at compile time.\r\n");
|
||||
fail();
|
||||
}
|
||||
opt_zstd++;
|
||||
}
|
||||
else if (strcmp(long_options[option_index].name, "max-flush-time") == 0)
|
||||
{
|
||||
@@ -364,12 +365,10 @@ int main(int argc, char **argv)
|
||||
|
||||
// on-the-fly zstd compression
|
||||
case 'Z':
|
||||
if (set_compress_mode(COMPRESS_ZSTD) != 0)
|
||||
if (set_compress_mode(COMPRESS_ZSTD) == 0)
|
||||
{
|
||||
fprintf(stderr, "zstd support has not been enabled at compile time.\r\n");
|
||||
fail();
|
||||
opt_zstd++;
|
||||
}
|
||||
opt_zstd++;
|
||||
break;
|
||||
|
||||
// compression level of compression algorithm
|
||||
@@ -2038,9 +2037,9 @@ void help(void)
|
||||
" -a, --append open the ttyrec output file in append mode instead of write-clobber mode\n");
|
||||
#ifdef HAVE_zstd
|
||||
fprintf(stderr, \
|
||||
" -Z, --zstd enable on-the-fly compression of output file using zstd,\n" \
|
||||
" -Z enable on-the-fly compression if available, silently fallback to no compression if not\n" \
|
||||
" --zstd force on-the-fly compression of output file using zstd,\n" \
|
||||
" the resulting file will have a '.ttyrec.zst' extension\n" \
|
||||
" --zstd-try enable on-the-fly zstd compression, silently fallback to no compression if not available\n" \
|
||||
" --max-flush-time S specify the maximum number of seconds after which we'll force zstd to flush its output buffers\n" \
|
||||
" to ensure that even somewhat quiet sessions gets regularly written out to disk, default is %d\n" \
|
||||
" -l, --level LEVEL set compression level, must be between 1 and 19 for zstd, default is 3\n" \
|
||||
|
||||
Reference in New Issue
Block a user