mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Restore -n, now after the command.
This commit is contained in:
parent
fb39b22a2e
commit
65eeb7e421
9
NOTES
9
NOTES
@ -12,7 +12,6 @@ Commands: d detach
|
||||
p previous window
|
||||
l last (next to last selected) window
|
||||
r refresh screen
|
||||
t set window name
|
||||
w list current windows
|
||||
0-9 select window
|
||||
|
||||
@ -21,7 +20,7 @@ There is one default server process per user which puts its socket in
|
||||
invocations will connect to the same server. The server holds multiple
|
||||
sessions.
|
||||
|
||||
Syntax is: tmux [-v] [-n name] [-s path] command
|
||||
Syntax is: tmux [-v] [-s path] command [flags]
|
||||
|
||||
The command is either list, new or attach. Create a new session with:
|
||||
|
||||
@ -29,11 +28,11 @@ The command is either list, new or attach. Create a new session with:
|
||||
|
||||
Optionally giving it a name with:
|
||||
|
||||
tmux -n <session name> new
|
||||
tmux new -n <session name>
|
||||
|
||||
Attach to a previous session with:
|
||||
|
||||
tmux -n <session name> attach
|
||||
tmux attach -n <session name>
|
||||
|
||||
A name must (currently) be specified when attaching. This may change.
|
||||
|
||||
@ -43,7 +42,7 @@ List all sessions with:
|
||||
|
||||
Or the windows of a single session with:
|
||||
|
||||
tmux -n <session name> list
|
||||
tmux list -n <session name>
|
||||
|
||||
Sessions are destroyed when no windows remain attached to them.
|
||||
|
||||
|
51
op.c
51
op.c
@ -1,4 +1,4 @@
|
||||
/* $Id: op.c,v 1.1 2007-09-26 13:43:15 nicm Exp $ */
|
||||
/* $Id: op.c,v 1.2 2007-09-26 14:08:16 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -19,6 +19,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
@ -27,14 +28,32 @@ op_new(char *path, int argc, unused char **argv)
|
||||
{
|
||||
struct new_data data;
|
||||
struct client_ctx cctx;
|
||||
char name[MAXNAMELEN];
|
||||
int opt;
|
||||
|
||||
if (argc != 0) /* XXX -n */
|
||||
return (usage("new"));
|
||||
optind = 1;
|
||||
while ((opt = getopt(argc, argv, "n:?")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
|
||||
log_warnx("%s: session name too long", optarg);
|
||||
return (1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
return (usage("new [-n session]"));
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc != 0)
|
||||
return (usage("new [-n session]"));
|
||||
|
||||
if (client_init(path, &cctx, 1) != 0)
|
||||
return (1);
|
||||
|
||||
strlcpy(data.name, "XXX"/*XXX*/, sizeof data.name);
|
||||
strlcpy(data.name, name, sizeof data.name);
|
||||
data.sx = cctx.ws.ws_col;
|
||||
data.sy = cctx.ws.ws_row;
|
||||
client_write_server(&cctx, MSG_NEW, &data, sizeof data);
|
||||
@ -47,14 +66,32 @@ op_attach(char *path, int argc, unused char **argv)
|
||||
{
|
||||
struct attach_data data;
|
||||
struct client_ctx cctx;
|
||||
char name[MAXNAMELEN];
|
||||
int opt;
|
||||
|
||||
if (argc != 0) /* XXX -n */
|
||||
return (usage("attach"));
|
||||
optind = 1;
|
||||
while ((opt = getopt(argc, argv, "n:?")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
|
||||
log_warnx("%s: session name too long", optarg);
|
||||
return (1);
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
return (usage("attach [-n session]"));
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc != 0)
|
||||
return (usage("attach [-n session]"));
|
||||
|
||||
if (client_init(path, &cctx, 1) != 0)
|
||||
return (1);
|
||||
|
||||
strlcpy(data.name, "XXX"/*XXX*/, sizeof data.name);
|
||||
strlcpy(data.name, name, sizeof data.name);
|
||||
data.sx = cctx.ws.ws_col;
|
||||
data.sy = cctx.ws.ws_row;
|
||||
client_write_server(&cctx, MSG_ATTACH, &data, sizeof data);
|
||||
|
9
tmux.c
9
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.9 2007-09-26 13:43:15 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.10 2007-09-26 14:08:16 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -53,7 +53,7 @@ int
|
||||
usage(const char *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
s = "command ...";
|
||||
s = "command [flags]";
|
||||
fprintf(stderr, "usage: %s [-v] [-s path] %s\n", __progname, s);
|
||||
return (1);
|
||||
}
|
||||
@ -182,11 +182,8 @@ main(int argc, char **argv)
|
||||
|
||||
for (i = 0; i < NOP; i++) {
|
||||
op = op_table + i;
|
||||
if (strncmp(argv[0], op->cmd, strlen(op->cmd)) == 0) {
|
||||
argc--;
|
||||
argv++;
|
||||
if (strncmp(argv[0], op->cmd, strlen(op->cmd)) == 0)
|
||||
exit(op->fn(path, argc, argv));
|
||||
}
|
||||
}
|
||||
|
||||
exit(usage(NULL));
|
||||
|
Loading…
Reference in New Issue
Block a user