diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-10-21 12:35:58 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-10-21 12:35:58 +0100 |
commit | 201036ad80f2e51f7238db2adf05914a4a4f5819 (patch) | |
tree | 9ccaf6a087b551846b1c6e71a865cda3aac8c0f1 /cmd-new-session.c | |
parent | 65257b8e9b55d8d180265d714ba9b3637643c6dc (diff) | |
parent | 696b5a628f0f31f4c3566b5c0ab51fbd9f9f9880 (diff) | |
download | rtmux-201036ad80f2e51f7238db2adf05914a4a4f5819.tar.gz rtmux-201036ad80f2e51f7238db2adf05914a4a4f5819.tar.bz2 rtmux-201036ad80f2e51f7238db2adf05914a4a4f5819.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index b36de70a..5823e5e1 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -31,6 +31,8 @@ * Create a new session and attach to the current terminal unless -d is given. */ +#define NEW_SESSION_TEMPLATE "#{session_name}:" + enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_session_entry = { @@ -40,7 +42,14 @@ const struct cmd_entry cmd_new_session_entry = { "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " "[-y height] [command]", CMD_STARTSERVER|CMD_CANTNEST, - NULL, + cmd_new_session_exec +}; + +const struct cmd_entry cmd_has_session_entry = { + "has-session", "has", + "t:", 0, 0, + CMD_TARGET_SESSION_USAGE, + 0, cmd_new_session_exec }; @@ -62,6 +71,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) struct format_tree *ft; struct environ_entry *envent; + if (self->entry == &cmd_has_session_entry) { + if (cmd_find_session(cmdq, args_get(args, 't'), 0) == NULL) + return (CMD_RETURN_ERROR); + return (CMD_RETURN_NORMAL); + } + if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) { cmdq_error(cmdq, "command or window name given with target"); return (CMD_RETURN_ERROR); |