Merge pull request #200 from weskoerber/fix/log-append-cli

fix: support --log-append in cli options
This commit is contained in:
Martin Lund 2023-07-14 09:25:41 +02:00 committed by GitHub
commit a486ba581b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View file

@ -91,6 +91,7 @@ The command-line interface is straightforward as reflected in the output from
-L, --list-devices List available serial devices -L, --list-devices List available serial devices
-l, --log Enable log to file -l, --log Enable log to file
--log-file <filename> Set log filename --log-file <filename> Set log filename
--log-append Append to log file
--log-strip Strip control characters and escape sequences --log-strip Strip control characters and escape sequences
-m, --map <flags> Map characters -m, --map <flags> Map characters
-c, --color 0..255|bold|none|list Colorize tio text (default: bold) -c, --color 0..255|bold|none|list Colorize tio text (default: bold)

View file

@ -390,6 +390,8 @@ Disable automatic connect
Enable log to file Enable log to file
.IP "\fBlog-file" .IP "\fBlog-file"
Set log filename Set log filename
.IP "\fBlog-append"
Append to log file
.IP "\fBlog-strip" .IP "\fBlog-strip"
Enable strip of control and escape sequences from log Enable strip of control and escape sequences from log
.IP "\fBlocal-echo" .IP "\fBlocal-echo"

View file

@ -305,6 +305,8 @@ CONFIGURATION FILE
log-file Set log filename log-file Set log filename
log-append Append to log file
log-strip Enable strip of control and escape sequences from log log-strip Enable strip of control and escape sequences from log
local-echo Enable local echo local-echo Enable local echo

View file

@ -22,6 +22,7 @@ _tio()
-e --local-echo \ -e --local-echo \
-l --log \ -l --log \
--log-file \ --log-file \
--log-append \
--log-strip \ --log-strip \
-m --map \ -m --map \
-t --timestamp \ -t --timestamp \
@ -90,6 +91,10 @@ _tio()
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
;; ;;
--log-append)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
--log-strip) --log-strip)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0

View file

@ -46,6 +46,7 @@ enum opt_t
OPT_TIMESTAMP_FORMAT, OPT_TIMESTAMP_FORMAT,
OPT_LOG_FILE, OPT_LOG_FILE,
OPT_LOG_STRIP, OPT_LOG_STRIP,
OPT_LOG_APPEND,
OPT_LINE_PULSE_DURATION, OPT_LINE_PULSE_DURATION,
OPT_RESPONSE_TIMEOUT, OPT_RESPONSE_TIMEOUT,
OPT_RS485, OPT_RS485,
@ -253,6 +254,7 @@ void options_parse(int argc, char *argv[])
{"list-devices", no_argument, 0, 'L' }, {"list-devices", no_argument, 0, 'L' },
{"log", no_argument, 0, 'l' }, {"log", no_argument, 0, 'l' },
{"log-file", required_argument, 0, OPT_LOG_FILE }, {"log-file", required_argument, 0, OPT_LOG_FILE },
{"log-append", no_argument, 0, OPT_LOG_APPEND },
{"log-strip", no_argument, 0, OPT_LOG_STRIP }, {"log-strip", no_argument, 0, OPT_LOG_STRIP },
{"socket", required_argument, 0, 'S' }, {"socket", required_argument, 0, 'S' },
{"map", required_argument, 0, 'm' }, {"map", required_argument, 0, 'm' },
@ -357,6 +359,10 @@ void options_parse(int argc, char *argv[])
option.log_strip = true; option.log_strip = true;
break; break;
case OPT_LOG_APPEND:
option.log_append = true;
break;
case 'S': case 'S':
option.socket = optarg; option.socket = optarg;
break; break;