mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Add -t to list-clients, based on a diff from Zac Sprackett.
This commit is contained in:
parent
044c0f978f
commit
f4432030ee
@ -31,8 +31,8 @@ int cmd_list_clients_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_list_clients_entry = {
|
const struct cmd_entry cmd_list_clients_entry = {
|
||||||
"list-clients", "lsc",
|
"list-clients", "lsc",
|
||||||
"", 0, 0,
|
"t:", 0, 0,
|
||||||
"",
|
CMD_TARGET_SESSION_USAGE,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@ -41,12 +41,21 @@ const struct cmd_entry cmd_list_clients_entry = {
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
cmd_list_clients_exec(unused struct cmd *self, struct cmd_ctx *ctx)
|
cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
struct args *args = self->args;
|
||||||
struct client *c;
|
struct client *c;
|
||||||
|
struct session *s;
|
||||||
u_int i;
|
u_int i;
|
||||||
const char *s_utf8;
|
const char *s_utf8;
|
||||||
|
|
||||||
|
if (args_has(args, 't')) {
|
||||||
|
s = cmd_find_session(ctx, args_get(args, 't'), 0);
|
||||||
|
if (s == NULL)
|
||||||
|
return (-1);
|
||||||
|
} else
|
||||||
|
s = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||||
c = ARRAY_ITEM(&clients, i);
|
c = ARRAY_ITEM(&clients, i);
|
||||||
if (c == NULL || c->session == NULL)
|
if (c == NULL || c->session == NULL)
|
||||||
@ -56,6 +65,9 @@ cmd_list_clients_exec(unused struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
s_utf8 = " (utf8)";
|
s_utf8 = " (utf8)";
|
||||||
else
|
else
|
||||||
s_utf8 = "";
|
s_utf8 = "";
|
||||||
|
|
||||||
|
if (s != NULL && s != c->session)
|
||||||
|
continue;
|
||||||
ctx->print(ctx, "%s: %s [%ux%u %s]%s", c->tty.path,
|
ctx->print(ctx, "%s: %s [%ux%u %s]%s", c->tty.path,
|
||||||
c->session->name, c->tty.sx, c->tty.sy,
|
c->session->name, c->tty.sx, c->tty.sy,
|
||||||
c->tty.termname, s_utf8);
|
c->tty.termname, s_utf8);
|
||||||
|
6
tmux.1
6
tmux.1
@ -598,9 +598,11 @@ server and clients and destroy all sessions.
|
|||||||
.It Ic kill-session Op Fl t Ar target-session
|
.It Ic kill-session Op Fl t Ar target-session
|
||||||
Destroy the given session, closing any windows linked to it and no other
|
Destroy the given session, closing any windows linked to it and no other
|
||||||
sessions, and detaching all clients attached to it.
|
sessions, and detaching all clients attached to it.
|
||||||
.It Ic list-clients
|
.It Ic list-clients Op Fl t Ar target-session
|
||||||
.D1 (alias: Ic lsc )
|
.D1 (alias: Ic lsc )
|
||||||
List all clients attached to the server.
|
List all clients attached to the server. If
|
||||||
|
.Ar target-session
|
||||||
|
is specified, list only clients connected to that session.
|
||||||
.It Ic list-commands
|
.It Ic list-commands
|
||||||
.D1 (alias: Ic lscm )
|
.D1 (alias: Ic lscm )
|
||||||
List the syntax of all commands supported by
|
List the syntax of all commands supported by
|
||||||
|
Loading…
Reference in New Issue
Block a user