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
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 [<options>] <tty-device|sub-config|tid>\n");
|
||||
printf("Usage: tio [<options>] <tty-device|profile|tid>\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 <bps> 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue