summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Permyakov <permyakovsv@gmail.com>2015-09-09 21:15:08 +0300
committerLamont Granquist <lamont@scriptkiddie.org>2015-10-24 20:25:11 -0700
commit6ae6710477ac618fafcfc46812984deae1b983b5 (patch)
tree4be9159644454b969960a24893ba21fadaa3d7a5
parenteed2c5a4d5f18bc0c41e4e4b8ba469a2148412e1 (diff)
downloadchef-6ae6710477ac618fafcfc46812984deae1b983b5.tar.gz
Add tmux-split parameter to knife ssh
-rw-r--r--lib/chef/knife/ssh.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 996f40c91d..1d3822b82f 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -394,7 +394,7 @@ class Chef
exec("screen -c #{tf.path}")
end
- def tmux
+ def tmux(split = false)
ssh_dest = lambda do |server|
identity = "-i #{config[:identity_file]} " if config[:identity_file]
prefix = server.user ? "#{server.user}@" : ""
@@ -404,7 +404,11 @@ class Chef
new_window_cmds = lambda do
if session.servers_for.size > 1
[""] + session.servers_for[1..-1].map do |server|
- "new-window -a -n '#{server.host}' #{ssh_dest.call(server)}"
+ if split
+ "split-window #{ssh_dest.call(server)}; tmux select-layout tiled"
+ else
+ "new-window -a -n '#{server.host}' #{ssh_dest.call(server)}"
+ end
end
else
[]
@@ -534,6 +538,8 @@ class Chef
screen
when "tmux"
tmux
+ when "tmux-split"
+ tmux(true)
when "macterm"
macterm
when "cssh"