From 6ae6710477ac618fafcfc46812984deae1b983b5 Mon Sep 17 00:00:00 2001 From: Sergey Permyakov Date: Wed, 9 Sep 2015 21:15:08 +0300 Subject: Add tmux-split parameter to knife ssh --- lib/chef/knife/ssh.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/chef/knife') 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" -- cgit v1.2.1