mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Extend op string and add potential for a single alias.
This commit is contained in:
parent
ab718378cb
commit
2a3e209cce
2
NOTES
2
NOTES
@ -2,6 +2,8 @@
|
|||||||
don't expect a lot of progress soon. Contributions welcome!
|
don't expect a lot of progress soon. Contributions welcome!
|
||||||
-- Nicholas <nicm@users.sf.net>
|
-- Nicholas <nicm@users.sf.net>
|
||||||
|
|
||||||
|
XXX This is out of date!
|
||||||
|
|
||||||
Command prefix is C-b. This can be changed by building with, for example:
|
Command prefix is C-b. This can be changed by building with, for example:
|
||||||
|
|
||||||
META=\\001 make
|
META=\\001 make
|
||||||
|
1
TODO
1
TODO
@ -21,3 +21,4 @@
|
|||||||
and buffer_insert_range/delete_range are abominations. this should be
|
and buffer_insert_range/delete_range are abominations. this should be
|
||||||
rethought
|
rethought
|
||||||
- figure out once and for all what is going on with backspace and del
|
- figure out once and for all what is going on with backspace and del
|
||||||
|
- split list into list-sessions and list-windows
|
||||||
|
4
client.c
4
client.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: client.c,v 1.4 2007-09-26 18:50:49 nicm Exp $ */
|
/* $Id: client.c,v 1.5 2007-09-26 19:09:30 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -165,7 +165,7 @@ client_main(struct client_ctx *cctx)
|
|||||||
/* XXX Output flushed; pause if required. */
|
/* XXX Output flushed; pause if required. */
|
||||||
if (n)
|
if (n)
|
||||||
usleep(750000);
|
usleep(750000);
|
||||||
/* XXX XXX special return code for pause */
|
/* XXX XXX special return code for pause? or flag in cctx? */
|
||||||
if ((n = client_process_local(cctx, &error)) == -1)
|
if ((n = client_process_local(cctx, &error)) == -1)
|
||||||
break;
|
break;
|
||||||
if ((n = client_msg_dispatch(cctx, &error)) == -1)
|
if ((n = client_msg_dispatch(cctx, &error)) == -1)
|
||||||
|
14
tmux.c
14
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.11 2007-09-26 18:32:16 nicm Exp $ */
|
/* $Id: tmux.c,v 1.12 2007-09-26 19:09:30 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -39,13 +39,14 @@ int debug_level;
|
|||||||
void sighandler(int);
|
void sighandler(int);
|
||||||
|
|
||||||
struct op {
|
struct op {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
|
const char *alias;
|
||||||
int (*fn)(char *, int, char **);
|
int (*fn)(char *, int, char **);
|
||||||
};
|
};
|
||||||
struct op op_table[] = {
|
struct op op_table[] = {
|
||||||
{ "list", op_list },
|
{ "attach", NULL, op_attach },
|
||||||
{ "new", op_new },
|
{ "list-sessions", "ls", op_list },
|
||||||
{ "attach", op_attach }
|
{ "new-session", "new", op_new },
|
||||||
};
|
};
|
||||||
#define NOP (sizeof op_table / sizeof op_table[0])
|
#define NOP (sizeof op_table / sizeof op_table[0])
|
||||||
|
|
||||||
@ -182,7 +183,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < NOP; i++) {
|
for (i = 0; i < NOP; i++) {
|
||||||
op = op_table + i;
|
op = op_table + i;
|
||||||
if (strncmp(argv[0], op->cmd, strlen(op->cmd)) == 0)
|
if (strncmp(argv[0], op->cmd, strlen(op->cmd)) == 0 ||
|
||||||
|
(op->alias != NULL && strcmp(argv[0], op->alias) == 0))
|
||||||
exit(op->fn(path, argc, argv));
|
exit(op->fn(path, argc, argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user