( sessionName: string, windowName: string, env?: Record<string, string>, startupCommand?: string )
| 125 | |
| 126 | function attachSession(sessionName: string): void { |
| 127 | execFileSync('tmux', ['attach-session', '-t', sessionName], { stdio: 'inherit' }); |
| 128 | } |
| 129 | |
| 130 | function createWindow( |
| 131 | sessionName: string, |
| 132 | windowName: string, |
| 133 | env?: Record<string, string>, |
| 134 | startupCommand?: string |
| 135 | ): number { |
| 136 | const args = [ |
| 137 | 'new-window', |
| 138 | '-d', |
| 139 | ...Object.entries(worktreeEnvironment(getWorktreeRoot(), env)).flatMap(([key, value]) => [ |
| 140 | '-e', |
| 141 | `${key}=${value}`, |
| 142 | ]), |
| 143 | '-t', |
| 144 | sessionName, |
| 145 | '-n', |
| 146 | windowName, |
| 147 | '-c', |
| 148 | getWorktreeRoot(), |
| 149 | '-P', |
| 150 | '-F', |
| 151 | '#{window_index}', |
| 152 | ]; |
| 153 | if (startupCommand) { |
| 154 | args.push(buildInteractiveShellCommand(startupCommand, undefined, getWorktreeRoot())); |
| 155 | } |
| 156 |
no test coverage detected