mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +02:00
add optional timestamps
with "-t" or "C-t T", toggle a timestamp prefix to each line.
This commit is contained in:
parent
36691e8bdf
commit
f96ad43b1f
4 changed files with 28 additions and 1 deletions
|
|
@ -46,6 +46,7 @@ struct option_t option =
|
|||
false, // No autoconnect
|
||||
false, // No log
|
||||
false, // No local echo
|
||||
false, // No timestamp
|
||||
"", // Log filename
|
||||
"" // Map string
|
||||
};
|
||||
|
|
@ -63,6 +64,7 @@ void print_help(char *argv[])
|
|||
printf(" -o, --output-delay <ms> Output delay (default: 0)\n");
|
||||
printf(" -n, --no-autoconnect Disable automatic connect\n");
|
||||
printf(" -e, --local-echo Do local echo\n");
|
||||
printf(" -t, --timestamp Prefix each new line with a timestamp\n");
|
||||
printf(" -l, --log <filename> Log to file\n");
|
||||
printf(" -m, --map <flags> Map special characters\n");
|
||||
printf(" -v, --version Display version\n");
|
||||
|
|
@ -112,6 +114,7 @@ void parse_options(int argc, char *argv[])
|
|||
{"output-delay", required_argument, 0, 'o'},
|
||||
{"no-autoconnect", no_argument, 0, 'n'},
|
||||
{"local-echo", no_argument, 0, 'e'},
|
||||
{"timestamp", no_argument, 0, 't'},
|
||||
{"log", required_argument, 0, 'l'},
|
||||
{"map", required_argument, 0, 'm'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
|
|
@ -123,7 +126,7 @@ void parse_options(int argc, char *argv[])
|
|||
int option_index = 0;
|
||||
|
||||
/* Parse argument using getopt_long */
|
||||
c = getopt_long(argc, argv, "b:d:f:s:p:o:nel:m:vh", long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "b:d:f:s:p:o:netl:m:vh", long_options, &option_index);
|
||||
|
||||
/* Detect the end of the options */
|
||||
if (c == -1)
|
||||
|
|
@ -173,6 +176,10 @@ void parse_options(int argc, char *argv[])
|
|||
option.local_echo = true;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
option.timestamp = true;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
option.log = true;
|
||||
option.log_filename = optarg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue