mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-17 00:51:36 +02:00
Move the user-visible parts of all options (names, types, limit, default
values) together into one set of tables in options-table.c. Also clean up and simplify cmd-set-options.c and move a common print function into option-table.c.
This commit is contained in:
@ -43,20 +43,19 @@ const struct cmd_entry cmd_show_options_entry = {
|
||||
int
|
||||
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_target_data *data = self->data;
|
||||
const struct set_option_entry *table;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct options *oo;
|
||||
struct options_entry *o;
|
||||
const struct set_option_entry *entry;
|
||||
const char *optval;
|
||||
struct cmd_target_data *data = self->data;
|
||||
const struct options_table_entry *table, *oe;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct options *oo;
|
||||
struct options_entry *o;
|
||||
const char *optval;
|
||||
|
||||
if (cmd_check_flag(data->chflags, 's')) {
|
||||
oo = &global_options;
|
||||
table = set_option_table;
|
||||
table = server_options_table;
|
||||
} else if (cmd_check_flag(data->chflags, 'w')) {
|
||||
table = set_window_option_table;
|
||||
table = window_options_table;
|
||||
if (cmd_check_flag(data->chflags, 'g'))
|
||||
oo = &global_w_options;
|
||||
else {
|
||||
@ -66,7 +65,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
oo = &wl->window->options;
|
||||
}
|
||||
} else {
|
||||
table = set_session_option_table;
|
||||
table = session_options_table;
|
||||
if (cmd_check_flag(data->chflags, 'g'))
|
||||
oo = &global_s_options;
|
||||
else {
|
||||
@ -77,11 +76,11 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
for (entry = table; entry->name != NULL; entry++) {
|
||||
if ((o = options_find1(oo, entry->name)) == NULL)
|
||||
for (oe = table; oe->name != NULL; oe++) {
|
||||
if ((o = options_find1(oo, oe->name)) == NULL)
|
||||
continue;
|
||||
optval = cmd_set_option_print(entry, o);
|
||||
ctx->print(ctx, "%s %s", entry->name, optval);
|
||||
optval = options_table_print_entry(oe, o);
|
||||
ctx->print(ctx, "%s %s", oe->name, optval);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
Reference in New Issue
Block a user