From 232cbee6974e2fb83168074c86fdac0f1f12c646 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 27 Apr 2024 09:13:29 +0200 Subject: [PATCH] Rename sub-config to profile Because better naming. --- README.md | 20 ++++++++++---------- examples/config/config | 2 +- man/tio.1.in | 20 +++++++++++--------- src/bash-completion/tio.in | 4 ++-- src/configfile.c | 8 ++++---- src/configfile.h | 2 +- src/main.c | 4 ++-- src/options.c | 22 +++++++++++----------- src/options.h | 2 +- 9 files changed, 43 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 9725b86..a196fd1 100644 --- a/README.md +++ b/README.md @@ -70,12 +70,12 @@ when used in combination with [tmux](https://tmux.github.io). * Overwrite (default) or append to log file * Strip control characters and escape sequences * Configuration file support - * Support for sub-configurations - * Activate sub-configurations by name or pattern + * Support for configuration profiles + * Activate configuration profiles by name or pattern * Redirect I/O to UNIX socket or IPv4/v6 network socket * Useful for scripting or TTY sharing * Pipe input and/or output - * Bash completion on options, serial device names, and sub-configuration names + * Bash completion on options, serial device names, and profile names * Configurable tio message text color * Supports NO_COLOR env variable as per [no-color.org](https://no-color.org) * Visual or audible alert on connect/disconnect @@ -99,9 +99,9 @@ For more usage details please see the man page documentation The command-line interface is straightforward as reflected in the output from 'tio --help': ``` -Usage: tio [] +Usage: tio [] -Connect to TTY device directly or via sub-configuration or topology ID. +Connect to TTY device directly or via configuration profile or topology ID. Options: -b, --baudrate Baud rate (default: 115200) @@ -142,7 +142,7 @@ Options: -v, --version Display version -h, --help Display help -Options and sub-configurations may be set via configuration file. +Options and profiles may be set via configuration file. See the man page for more details. ``` @@ -428,9 +428,9 @@ following locations in the order listed: - $HOME/.config/tio/config - $HOME/.tioconfig -The configuration file supports sub-configurations using named sections which can -be activated via the command-line by name or pattern. A sub-configuration -specifies which TTY device to connect to and other options. +The configuration file supports profiles using named sections which can be +activated via the command-line by name or pattern. A profile specifies which +TTY device to connect to and other options. ### 3.4.1 Examples @@ -470,7 +470,7 @@ device = /dev/ttyUSB%s color = 14 ``` -To use a specific sub-configuration by name simply start tio like so: +To use a specific profile by name simply start tio like so: ``` $ tio rpi3 ``` diff --git a/examples/config/config b/examples/config/config index 200ec79..4e0de75 100644 --- a/examples/config/config +++ b/examples/config/config @@ -32,7 +32,7 @@ rs-485 = disable alert = none script-run = always -# Sub-configurations +# Configuration profiles [rpi3] baudrate = 115200 diff --git a/man/tio.1.in b/man/tio.1.in index 861ccf0..4507d2f 100644 --- a/man/tio.1.in +++ b/man/tio.1.in @@ -6,7 +6,7 @@ tio \- a serial device I/O tool .SH "SYNOPSIS" .PP .B tio -.RI "[" "] " "" +.RI "[" "] " "" .SH "DESCRIPTION" .PP @@ -481,11 +481,11 @@ listed: .I $HOME/.tioconfig .PP -Labels can be used to group settings into named sub-configurations which can be -activated from the command-line when starting tio. +Labels can be used to group settings into named configuration profiles which +can be activated from the command-line when starting tio. .PP -\fBtio\fR will try to match the user input to a sub-configuration by name or by +\fBtio\fR will try to match the user input to a configuration profile by name or by pattern to get the TTY device and other options. .PP @@ -585,7 +585,7 @@ line-pulse-duration = DTR=200,RTS=400 .RE .TP -Named sub-configurations can be added via labels: +Named configuration profiles can be added via labels: .RS .nf @@ -599,7 +599,7 @@ color = 11 .RE .TP -Activate the sub-configuration by name: +Activate the configuration profile by name: $ tio rpi3 @@ -609,7 +609,8 @@ Which is equivalent to: $ tio -b 115200 -c 11 /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0 .TP -A sub-configuration can also be activated by its pattern which supports regular expressions: +A configuration profile can also be activated by its pattern which supports +regular expressions: .RS .nf @@ -623,7 +624,7 @@ baudrate = 115200 .RE .TP -Activate the sub-configuration by pattern match: +Activate the configuration profile by pattern match: $ tio usb12 @@ -633,7 +634,8 @@ Which is equivalent to: $ tio -b 115200 /dev/ttyUSB12 .TP -It is also possible to combine use of sub-configuration and command-line options. For example: +It is also possible to combine use of configuration profile and command-line +options. For example: $ tio -l -t usb12 diff --git a/src/bash-completion/tio.in b/src/bash-completion/tio.in index 4eb902a..75a207c 100644 --- a/src/bash-completion/tio.in +++ b/src/bash-completion/tio.in @@ -197,14 +197,14 @@ _tio() ;; esac - sub_configs="`tio --complete-sub-configs`" + profiles="`tio --complete-profiles`" if [ -d /dev/serial/by-id ]; then ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*) else ttys=$(printf '%s\n' /dev/tty*) fi - COMPREPLY=( $(compgen -W "${ttys} ${sub_configs}" -- ${cur}) ) + COMPREPLY=( $(compgen -W "${ttys} ${profiles}" -- ${cur}) ) return 0 } diff --git a/src/configfile.c b/src/configfile.c index 00e4fb4..0357b53 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -455,7 +455,7 @@ static int resolve_config_file(void) return -EINVAL; } -void config_file_show_sub_configurations(void) +void config_file_show_profiles(void) { memset(&c, 0, sizeof(struct config_t)); @@ -482,7 +482,7 @@ void config_file_parse(void) return; } - // Set user input which may be tty device or sub config or tid + // Set user input which may be tty device or profile or tid c.user = option.target; if (!c.user) @@ -513,7 +513,7 @@ void config_file_parse(void) } } - // Parse settings of found section (sub config) + // Parse settings of found section (profile) ret = ini_parse(c.path, data_handler, NULL); if (ret < 0) { @@ -544,7 +544,7 @@ void config_file_print(void) tio_printf(" Active configuration file: %s", c.path); if (c.section_name != NULL) { - tio_printf(" Active sub-configuration: %s", c.section_name); + tio_printf(" Active configuration profile: %s", c.section_name); } } } diff --git a/src/configfile.h b/src/configfile.h index 7748149..554df3c 100644 --- a/src/configfile.h +++ b/src/configfile.h @@ -25,4 +25,4 @@ void config_file_print(void); void config_file_parse(void); void config_exit(void); -void config_file_show_sub_configurations(void); +void config_file_show_profiles(void); diff --git a/src/main.c b/src/main.c index 79b9a90..269995e 100644 --- a/src/main.c +++ b/src/main.c @@ -45,9 +45,9 @@ int main(int argc, char *argv[]) /* Parse command-line options (1st pass) */ options_parse(argc, argv); - if (option.complete_sub_configs) + if (option.complete_profiles) { - config_file_show_sub_configurations(); + config_file_show_profiles(); return status; } diff --git a/src/options.c b/src/options.c index e95d129..73c5bc8 100644 --- a/src/options.c +++ b/src/options.c @@ -54,7 +54,7 @@ enum opt_t OPT_RS485, OPT_RS485_CONFIG, OPT_ALERT, - OPT_COMPLETE_SUB_CONFIGS, + OPT_COMPLETE_PROFILES, OPT_MUTE, OPT_SCRIPT, OPT_SCRIPT_FILE, @@ -106,7 +106,7 @@ struct option_t option = .rs485_delay_rts_before_send = -1, .rs485_delay_rts_after_send = -1, .alert = ALERT_NONE, - .complete_sub_configs = false, + .complete_profiles = false, .script = NULL, .script_filename = NULL, .script_run = SCRIPT_RUN_ALWAYS, @@ -120,9 +120,9 @@ void print_help(char *argv[]) { UNUSED(argv); - printf("Usage: tio [] \n"); + printf("Usage: tio [] \n"); printf("\n"); - printf("Connect to TTY device directly or via sub-configuration or topology ID.\n"); + printf("Connect to TTY device directly or via configuration profile or topology ID.\n"); printf("\n"); printf("Options:\n"); printf(" -b, --baudrate Baud rate (default: 115200)\n"); @@ -163,7 +163,7 @@ void print_help(char *argv[]) printf(" -v, --version Display version\n"); printf(" -h, --help Display help\n"); printf("\n"); - printf("Options and sub-configurations may be set via configuration file.\n"); + printf("Options and profiles may be set via configuration file.\n"); printf("\n"); printf("See the man page for more details.\n"); } @@ -464,7 +464,7 @@ void options_parse(int argc, char *argv[]) {"script-run", required_argument, 0, OPT_SCRIPT_RUN }, {"version", no_argument, 0, 'v' }, {"help", no_argument, 0, 'h' }, - {"complete-sub-configs", no_argument, 0, OPT_COMPLETE_SUB_CONFIGS}, + {"complete-profiles", no_argument, 0, OPT_COMPLETE_PROFILES }, {0, 0, 0, 0 } }; @@ -667,8 +667,8 @@ void options_parse(int argc, char *argv[]) exit(EXIT_SUCCESS); break; - case OPT_COMPLETE_SUB_CONFIGS: - option.complete_sub_configs = true; + case OPT_COMPLETE_PROFILES: + option.complete_profiles = true; break; case '?': @@ -681,7 +681,7 @@ void options_parse(int argc, char *argv[]) } } - /* Assume first non-option is the target (tty device, sub-config, tid) */ + /* Assume first non-option is the target (tty device, profile, tid) */ if (strcmp(option.target, "")) { optind++; @@ -691,7 +691,7 @@ void options_parse(int argc, char *argv[]) option.target = argv[optind++]; } - if (option.complete_sub_configs) + if (option.complete_profiles) { return; } @@ -703,7 +703,7 @@ void options_parse(int argc, char *argv[]) if (strlen(option.target) == 0) { - tio_error_printf("Missing tty device, sub-configuration or topology ID"); + tio_error_printf("Missing tty device, profile or topology ID"); exit(EXIT_FAILURE); } diff --git a/src/options.h b/src/options.h index 2522bee..48048cb 100644 --- a/src/options.h +++ b/src/options.h @@ -86,7 +86,7 @@ struct option_t int32_t rs485_delay_rts_before_send; int32_t rs485_delay_rts_after_send; alert_t alert; - bool complete_sub_configs; + bool complete_profiles; const char *script; const char *script_filename; script_run_t script_run;