mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Add -e for new-session.
This commit is contained in:
		@@ -39,10 +39,10 @@ const struct cmd_entry cmd_new_session_entry = {
 | 
				
			|||||||
	.name = "new-session",
 | 
						.name = "new-session",
 | 
				
			||||||
	.alias = "new",
 | 
						.alias = "new",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.args = { "Ac:dDEF:n:Ps:t:x:Xy:", 0, -1 },
 | 
						.args = { "Ac:dDe:EF:n:Ps:t:x:Xy:", 0, -1 },
 | 
				
			||||||
	.usage = "[-AdDEPX] [-c start-directory] [-F format] [-n window-name] "
 | 
						.usage = "[-AdDEPX] [-c start-directory] [-e environment] [-F format] "
 | 
				
			||||||
		 "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
 | 
							 "[-n window-name] [-s session-name] "
 | 
				
			||||||
		 "[-y height] [command]",
 | 
							 CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
 | 
						.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -75,7 +75,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	struct options		*oo;
 | 
						struct options		*oo;
 | 
				
			||||||
	struct termios		 tio, *tiop;
 | 
						struct termios		 tio, *tiop;
 | 
				
			||||||
	struct session_group	*sg = NULL;
 | 
						struct session_group	*sg = NULL;
 | 
				
			||||||
	const char		*errstr, *template, *group, *tmp;
 | 
						const char		*errstr, *template, *group, *tmp, *add;
 | 
				
			||||||
	char			*cause, *cwd = NULL, *cp, *newname = NULL;
 | 
						char			*cause, *cwd = NULL, *cp, *newname = NULL;
 | 
				
			||||||
	char			*name, *prefix = NULL;
 | 
						char			*name, *prefix = NULL;
 | 
				
			||||||
	int			 detached, already_attached, is_control = 0;
 | 
						int			 detached, already_attached, is_control = 0;
 | 
				
			||||||
@@ -83,6 +83,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	struct spawn_context	 sc;
 | 
						struct spawn_context	 sc;
 | 
				
			||||||
	enum cmd_retval		 retval;
 | 
						enum cmd_retval		 retval;
 | 
				
			||||||
	struct cmd_find_state    fs;
 | 
						struct cmd_find_state    fs;
 | 
				
			||||||
 | 
						struct args_value	*value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cmd_get_entry(self) == &cmd_has_session_entry) {
 | 
						if (cmd_get_entry(self) == &cmd_has_session_entry) {
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
@@ -254,6 +255,11 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	env = environ_create();
 | 
						env = environ_create();
 | 
				
			||||||
	if (c != NULL && !args_has(args, 'E'))
 | 
						if (c != NULL && !args_has(args, 'E'))
 | 
				
			||||||
		environ_update(global_s_options, c->environ, env);
 | 
							environ_update(global_s_options, c->environ, env);
 | 
				
			||||||
 | 
						add = args_first_value(args, 'e', &value);
 | 
				
			||||||
 | 
						while (add != NULL) {
 | 
				
			||||||
 | 
							environ_put(env, add, 0);
 | 
				
			||||||
 | 
							add = args_next_value(&value);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	s = session_create(prefix, newname, cwd, env, oo, tiop);
 | 
						s = session_create(prefix, newname, cwd, env, oo, tiop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Spawn the initial window. */
 | 
						/* Spawn the initial window. */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1094,6 +1094,7 @@ Lock all clients attached to
 | 
				
			|||||||
.It Xo Ic new-session
 | 
					.It Xo Ic new-session
 | 
				
			||||||
.Op Fl AdDEPX
 | 
					.Op Fl AdDEPX
 | 
				
			||||||
.Op Fl c Ar start-directory
 | 
					.Op Fl c Ar start-directory
 | 
				
			||||||
 | 
					.Op Fl e Ar environment
 | 
				
			||||||
.Op Fl F Ar format
 | 
					.Op Fl F Ar format
 | 
				
			||||||
.Op Fl n Ar window-name
 | 
					.Op Fl n Ar window-name
 | 
				
			||||||
.Op Fl s Ar session-name
 | 
					.Op Fl s Ar session-name
 | 
				
			||||||
@@ -1200,6 +1201,11 @@ If
 | 
				
			|||||||
is used, the
 | 
					is used, the
 | 
				
			||||||
.Ic update-environment
 | 
					.Ic update-environment
 | 
				
			||||||
option will not be applied.
 | 
					option will not be applied.
 | 
				
			||||||
 | 
					.Fl e
 | 
				
			||||||
 | 
					takes the form
 | 
				
			||||||
 | 
					.Ql VARIABLE=value
 | 
				
			||||||
 | 
					and sets an environment variable for the newly created session; it may be
 | 
				
			||||||
 | 
					specified multiple times.
 | 
				
			||||||
.It Xo Ic refresh-client
 | 
					.It Xo Ic refresh-client
 | 
				
			||||||
.Op Fl cDlLRSU
 | 
					.Op Fl cDlLRSU
 | 
				
			||||||
.Op Fl C Ar XxY
 | 
					.Op Fl C Ar XxY
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user