mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2025-06-21 10:27:48 +02:00
Add -d option for debug messages
This commit is contained in:
parent
83af722da2
commit
930535cbea
@ -9,6 +9,7 @@ ctpv \- terminal previewer
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.
|
.
|
||||||
.SY ctpv
|
.SY ctpv
|
||||||
|
.RI [ \-d ]
|
||||||
.I file
|
.I file
|
||||||
.RI [ w ]
|
.RI [ w ]
|
||||||
.RI [ h ]
|
.RI [ h ]
|
||||||
@ -282,6 +283,10 @@ command to server with ID
|
|||||||
Kill server with ID
|
Kill server with ID
|
||||||
.IR id .
|
.IR id .
|
||||||
.
|
.
|
||||||
|
.TP
|
||||||
|
.B \-d
|
||||||
|
Enable debug messages.
|
||||||
|
.
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
.
|
.
|
||||||
.B ctpv
|
.B ctpv
|
||||||
|
@ -411,9 +411,10 @@ int main(int argc, char *argv[])
|
|||||||
program = argc > 0 ? argv[0] : "ctpv";
|
program = argc > 0 ? argv[0] : "ctpv";
|
||||||
|
|
||||||
ctpv.opts.shell = "/bin/sh";
|
ctpv.opts.shell = "/bin/sh";
|
||||||
|
ctpv.debug = 0;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "hs:c:e:lmv")) != -1) {
|
while ((c = getopt(argc, argv, "hs:c:e:lmdv")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
ctpv.mode = MODE_HELP;
|
ctpv.mode = MODE_HELP;
|
||||||
@ -436,6 +437,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'm':
|
case 'm':
|
||||||
ctpv.mode = MODE_MIME;
|
ctpv.mode = MODE_MIME;
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
ctpv.debug = 1;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
ctpv.mode = MODE_VERSION;
|
ctpv.mode = MODE_VERSION;
|
||||||
break;
|
break;
|
||||||
|
@ -20,6 +20,7 @@ struct CTPV {
|
|||||||
int autochafa, chafasixel, showgpg;
|
int autochafa, chafasixel, showgpg;
|
||||||
char *shell;
|
char *shell;
|
||||||
} opts;
|
} opts;
|
||||||
|
int debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct CTPV ctpv;
|
extern struct CTPV ctpv;
|
||||||
|
@ -201,10 +201,15 @@ run:
|
|||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctpv.debug)
|
||||||
|
fprintf(stderr, "Running preview: %s\n", p->name);
|
||||||
|
|
||||||
ERRCHK_RET_OK(run(p, &exitcode, &signal));
|
ERRCHK_RET_OK(run(p, &exitcode, &signal));
|
||||||
|
|
||||||
switch (exitcode) {
|
switch (exitcode) {
|
||||||
case FAILED_PREVIEW_EC:
|
case FAILED_PREVIEW_EC:
|
||||||
|
if (ctpv.debug)
|
||||||
|
fprintf(stderr, "Preview %s failed\n", p->name);
|
||||||
i++;
|
i++;
|
||||||
goto run;
|
goto run;
|
||||||
case ENOUGH_READ_EC:
|
case ENOUGH_READ_EC:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user