mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Rename sub-config to profile
Because better naming.
This commit is contained in:
parent
1b77ed783b
commit
232cbee697
9 changed files with 43 additions and 41 deletions
20
README.md
20
README.md
|
|
@ -70,12 +70,12 @@ when used in combination with [tmux](https://tmux.github.io).
|
||||||
* Overwrite (default) or append to log file
|
* Overwrite (default) or append to log file
|
||||||
* Strip control characters and escape sequences
|
* Strip control characters and escape sequences
|
||||||
* Configuration file support
|
* Configuration file support
|
||||||
* Support for sub-configurations
|
* Support for configuration profiles
|
||||||
* Activate sub-configurations by name or pattern
|
* Activate configuration profiles by name or pattern
|
||||||
* Redirect I/O to UNIX socket or IPv4/v6 network socket
|
* Redirect I/O to UNIX socket or IPv4/v6 network socket
|
||||||
* Useful for scripting or TTY sharing
|
* Useful for scripting or TTY sharing
|
||||||
* Pipe input and/or output
|
* 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
|
* Configurable tio message text color
|
||||||
* Supports NO_COLOR env variable as per [no-color.org](https://no-color.org)
|
* Supports NO_COLOR env variable as per [no-color.org](https://no-color.org)
|
||||||
* Visual or audible alert on connect/disconnect
|
* 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
|
The command-line interface is straightforward as reflected in the output from
|
||||||
'tio --help':
|
'tio --help':
|
||||||
```
|
```
|
||||||
Usage: tio [<options>] <tty-device|sub-config|tid>
|
Usage: tio [<options>] <tty-device|profile|tid>
|
||||||
|
|
||||||
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:
|
Options:
|
||||||
-b, --baudrate <bps> Baud rate (default: 115200)
|
-b, --baudrate <bps> Baud rate (default: 115200)
|
||||||
|
|
@ -142,7 +142,7 @@ Options:
|
||||||
-v, --version Display version
|
-v, --version Display version
|
||||||
-h, --help Display help
|
-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.
|
See the man page for more details.
|
||||||
```
|
```
|
||||||
|
|
@ -428,9 +428,9 @@ following locations in the order listed:
|
||||||
- $HOME/.config/tio/config
|
- $HOME/.config/tio/config
|
||||||
- $HOME/.tioconfig
|
- $HOME/.tioconfig
|
||||||
|
|
||||||
The configuration file supports sub-configurations using named sections which can
|
The configuration file supports profiles using named sections which can be
|
||||||
be activated via the command-line by name or pattern. A sub-configuration
|
activated via the command-line by name or pattern. A profile specifies which
|
||||||
specifies which TTY device to connect to and other options.
|
TTY device to connect to and other options.
|
||||||
|
|
||||||
### 3.4.1 Examples
|
### 3.4.1 Examples
|
||||||
|
|
||||||
|
|
@ -470,7 +470,7 @@ device = /dev/ttyUSB%s
|
||||||
color = 14
|
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
|
$ tio rpi3
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ rs-485 = disable
|
||||||
alert = none
|
alert = none
|
||||||
script-run = always
|
script-run = always
|
||||||
|
|
||||||
# Sub-configurations
|
# Configuration profiles
|
||||||
|
|
||||||
[rpi3]
|
[rpi3]
|
||||||
baudrate = 115200
|
baudrate = 115200
|
||||||
|
|
|
||||||
20
man/tio.1.in
20
man/tio.1.in
|
|
@ -6,7 +6,7 @@ tio \- a serial device I/O tool
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
.PP
|
.PP
|
||||||
.B tio
|
.B tio
|
||||||
.RI "[" <options> "] " "<tty-device|sub-config>"
|
.RI "[" <options> "] " "<tty-device|profile|tid>"
|
||||||
|
|
||||||
.SH "DESCRIPTION"
|
.SH "DESCRIPTION"
|
||||||
.PP
|
.PP
|
||||||
|
|
@ -481,11 +481,11 @@ listed:
|
||||||
.I $HOME/.tioconfig
|
.I $HOME/.tioconfig
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Labels can be used to group settings into named sub-configurations which can be
|
Labels can be used to group settings into named configuration profiles which
|
||||||
activated from the command-line when starting tio.
|
can be activated from the command-line when starting tio.
|
||||||
|
|
||||||
.PP
|
.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.
|
pattern to get the TTY device and other options.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
@ -585,7 +585,7 @@ line-pulse-duration = DTR=200,RTS=400
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
Named sub-configurations can be added via labels:
|
Named configuration profiles can be added via labels:
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
@ -599,7 +599,7 @@ color = 11
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
Activate the sub-configuration by name:
|
Activate the configuration profile by name:
|
||||||
|
|
||||||
$ tio rpi3
|
$ 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
|
$ tio -b 115200 -c 11 /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
|
||||||
|
|
||||||
.TP
|
.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
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
@ -623,7 +624,7 @@ baudrate = 115200
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
Activate the sub-configuration by pattern match:
|
Activate the configuration profile by pattern match:
|
||||||
|
|
||||||
$ tio usb12
|
$ tio usb12
|
||||||
|
|
||||||
|
|
@ -633,7 +634,8 @@ Which is equivalent to:
|
||||||
$ tio -b 115200 /dev/ttyUSB12
|
$ tio -b 115200 /dev/ttyUSB12
|
||||||
|
|
||||||
.TP
|
.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
|
$ tio -l -t usb12
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,14 +197,14 @@ _tio()
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sub_configs="`tio --complete-sub-configs`"
|
profiles="`tio --complete-profiles`"
|
||||||
|
|
||||||
if [ -d /dev/serial/by-id ]; then
|
if [ -d /dev/serial/by-id ]; then
|
||||||
ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*)
|
ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*)
|
||||||
else
|
else
|
||||||
ttys=$(printf '%s\n' /dev/tty*)
|
ttys=$(printf '%s\n' /dev/tty*)
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $(compgen -W "${ttys} ${sub_configs}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${ttys} ${profiles}" -- ${cur}) )
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,7 @@ static int resolve_config_file(void)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_file_show_sub_configurations(void)
|
void config_file_show_profiles(void)
|
||||||
{
|
{
|
||||||
memset(&c, 0, sizeof(struct config_t));
|
memset(&c, 0, sizeof(struct config_t));
|
||||||
|
|
||||||
|
|
@ -482,7 +482,7 @@ void config_file_parse(void)
|
||||||
return;
|
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;
|
c.user = option.target;
|
||||||
|
|
||||||
if (!c.user)
|
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);
|
ret = ini_parse(c.path, data_handler, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -544,7 +544,7 @@ void config_file_print(void)
|
||||||
tio_printf(" Active configuration file: %s", c.path);
|
tio_printf(" Active configuration file: %s", c.path);
|
||||||
if (c.section_name != NULL)
|
if (c.section_name != NULL)
|
||||||
{
|
{
|
||||||
tio_printf(" Active sub-configuration: %s", c.section_name);
|
tio_printf(" Active configuration profile: %s", c.section_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,4 @@
|
||||||
void config_file_print(void);
|
void config_file_print(void);
|
||||||
void config_file_parse(void);
|
void config_file_parse(void);
|
||||||
void config_exit(void);
|
void config_exit(void);
|
||||||
void config_file_show_sub_configurations(void);
|
void config_file_show_profiles(void);
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ int main(int argc, char *argv[])
|
||||||
/* Parse command-line options (1st pass) */
|
/* Parse command-line options (1st pass) */
|
||||||
options_parse(argc, argv);
|
options_parse(argc, argv);
|
||||||
|
|
||||||
if (option.complete_sub_configs)
|
if (option.complete_profiles)
|
||||||
{
|
{
|
||||||
config_file_show_sub_configurations();
|
config_file_show_profiles();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ enum opt_t
|
||||||
OPT_RS485,
|
OPT_RS485,
|
||||||
OPT_RS485_CONFIG,
|
OPT_RS485_CONFIG,
|
||||||
OPT_ALERT,
|
OPT_ALERT,
|
||||||
OPT_COMPLETE_SUB_CONFIGS,
|
OPT_COMPLETE_PROFILES,
|
||||||
OPT_MUTE,
|
OPT_MUTE,
|
||||||
OPT_SCRIPT,
|
OPT_SCRIPT,
|
||||||
OPT_SCRIPT_FILE,
|
OPT_SCRIPT_FILE,
|
||||||
|
|
@ -106,7 +106,7 @@ struct option_t option =
|
||||||
.rs485_delay_rts_before_send = -1,
|
.rs485_delay_rts_before_send = -1,
|
||||||
.rs485_delay_rts_after_send = -1,
|
.rs485_delay_rts_after_send = -1,
|
||||||
.alert = ALERT_NONE,
|
.alert = ALERT_NONE,
|
||||||
.complete_sub_configs = false,
|
.complete_profiles = false,
|
||||||
.script = NULL,
|
.script = NULL,
|
||||||
.script_filename = NULL,
|
.script_filename = NULL,
|
||||||
.script_run = SCRIPT_RUN_ALWAYS,
|
.script_run = SCRIPT_RUN_ALWAYS,
|
||||||
|
|
@ -120,9 +120,9 @@ void print_help(char *argv[])
|
||||||
{
|
{
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
|
|
||||||
printf("Usage: tio [<options>] <tty-device|sub-config|tid>\n");
|
printf("Usage: tio [<options>] <tty-device|profile|tid>\n");
|
||||||
printf("\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("\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" -b, --baudrate <bps> Baud rate (default: 115200)\n");
|
printf(" -b, --baudrate <bps> Baud rate (default: 115200)\n");
|
||||||
|
|
@ -163,7 +163,7 @@ void print_help(char *argv[])
|
||||||
printf(" -v, --version Display version\n");
|
printf(" -v, --version Display version\n");
|
||||||
printf(" -h, --help Display help\n");
|
printf(" -h, --help Display help\n");
|
||||||
printf("\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("\n");
|
||||||
printf("See the man page for more details.\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 },
|
{"script-run", required_argument, 0, OPT_SCRIPT_RUN },
|
||||||
{"version", no_argument, 0, 'v' },
|
{"version", no_argument, 0, 'v' },
|
||||||
{"help", no_argument, 0, 'h' },
|
{"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 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -667,8 +667,8 @@ void options_parse(int argc, char *argv[])
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_COMPLETE_SUB_CONFIGS:
|
case OPT_COMPLETE_PROFILES:
|
||||||
option.complete_sub_configs = true;
|
option.complete_profiles = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
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, ""))
|
if (strcmp(option.target, ""))
|
||||||
{
|
{
|
||||||
optind++;
|
optind++;
|
||||||
|
|
@ -691,7 +691,7 @@ void options_parse(int argc, char *argv[])
|
||||||
option.target = argv[optind++];
|
option.target = argv[optind++];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.complete_sub_configs)
|
if (option.complete_profiles)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -703,7 +703,7 @@ void options_parse(int argc, char *argv[])
|
||||||
|
|
||||||
if (strlen(option.target) == 0)
|
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);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ struct option_t
|
||||||
int32_t rs485_delay_rts_before_send;
|
int32_t rs485_delay_rts_before_send;
|
||||||
int32_t rs485_delay_rts_after_send;
|
int32_t rs485_delay_rts_after_send;
|
||||||
alert_t alert;
|
alert_t alert;
|
||||||
bool complete_sub_configs;
|
bool complete_profiles;
|
||||||
const char *script;
|
const char *script;
|
||||||
const char *script_filename;
|
const char *script_filename;
|
||||||
script_run_t script_run;
|
script_run_t script_run;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue