summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-02-24 00:43:28 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-02-24 00:43:28 +0000
commitf339cfd31563aaae0ae94361228bb697c83aa3bf (patch)
treee757507211a47b2cd9c8e2e782cc774ecfa96e29 /cmd-new-session.c
parentc5239c59846c2d09725d4b1db0e728b3376c3998 (diff)
Add -A flag to new-session to make it behave like attach-session if the session
exists. If -A is used, -D behaves like -d to attach-session.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 323bc16a..3b1e917f 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -35,8 +35,8 @@ enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = {
"new-session", "new",
- "dn:s:t:x:y:", 0, 1,
- "[-d] [-n window-name] [-s session-name] " CMD_TARGET_SESSION_USAGE
+ "AdDn:s:t:x:y:", 0, 1,
+ "[-AdD] [-n window-name] [-s session-name] " CMD_TARGET_SESSION_USAGE
" [-x width] [-y height] [command]",
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
NULL,
@@ -76,6 +76,10 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
}
if (session_find(newname) != NULL) {
+ if (args_has(args, 'A')) {
+ return (cmd_attach_session(cmdq, newname,
+ args_has(args, 'D'), 0));
+ }
cmdq_error(cmdq, "duplicate session: %s", newname);
return (CMD_RETURN_ERROR);
}