App-MultiSsh
view release on metacpan or search on metacpan
Adding better default config to show how it must work (Ivan Wills)
0.25 2022-09-10
Updating for release of version 0.25
Updated (Ivan Wills)
Adding listing of groups option (Ivan Wills)
0.24 2020-04-02
Updating for release of version 0.24
Got tests to match code changes (Ivan Wills)
Making is possible to control synchronize-pages's state (Ivan Wills)
Fixed the test (Ivan Wills)
Removed warning (Ivan Wills)
Adding more info to show which server your are connected to (Ivan Wills)
0.23 2020-01-08
Updating for release of version 0.23
Updated date (Ivan Wills)
Added note about usage (Ivan Wills)
making bin wait (Ivan Wills)
Fixing up travis build versions (Ivan Wills)
Added new dependency (Ivan Wills)
Added prefixing interleaved lines with the host it's from (Ivan Wills)
Added a list of things todo (Ivan Wills)
0.16 2015-10-11
Updating for release of version 0.16
Fixed clusterssh command support (Ivan Wills)
Added more diagnostics of missing cssh/tmux (Ivan Wills)
Fixed documentation and workings (Ivan Wills)
Fixed tests (Ivan Wills)
Added default synchronize panes option (Ivan Wills)
0.15 2015-10-04
Updating for release of version 0.15
Improving how mscp works so it can use groups (Ivan Wills)
0.14 2015-09-27
Updating for release of version 0.14
Added documentation (Ivan Wills)
Added documentation about --groups (Ivan Wills)
New dependency added (Ivan Wills)
Added config for coveralls.io (Ivan Wills)
Fixed whitespace (Ivan Wills)
Fixed issue with getopt long syntax (Ivan Wills)
0.10 2015-01-03
Updating for release of version 0.10
Changed dependency of Path::Class to Path::Tiny, stopped shelling out to which (Ivan Wills)
Updated LICENSE details (Ivan Wills)
Improving tmux support and documentation (Ivan Wills)
Fixed test work with synch rules (Ivan Wills)
Added synchronising pages only when a command is being run (Ivan Wills)
Fixed not running with --tmux option (Ivan Wills)
Added missing command documentation (Ivan Wills)
Cleaned up test (Ivan Wills)
Deleted file as "^B :setw synchronize-panes" does the trick (Ivan Wills)
Control script for tmux (Ivan Wills)
Got tmux working (Ivan Wills)
Created test to build layout (Ivan Wills)
Working on tmux layout (Ivan Wills)
Updating for release of version 0.04 (Ivan Wills)
Added missing documentation (Ivan Wills)
Updated missing dependencies (Ivan Wills)
0.04 2014-09-15
Added missing documentation (Ivan Wills)
--cssh-cmd[=]str
Use str as the C<cssh> program (defaults to cssh found in $PATH)
-m --tmux Create a tmux session with each window pane connecting to a host
--tmux-cmd[=]str
Use str as the C<tmux> program (defaults to tmux found in $PATH)
-n --tmux-nested
Use this fag when running in an existing tmux session to split up
the current tmux window in the same fashion as running a sepperate
tmux session.
--tmux-sync
--sync Turn on TMUX synchronize pages
--no-sync Turn off TMUX synchronize pages (Default)
-o --only-hosts
No command passed (all arguments are hosts)
-v --verbose Show more detailed option
--VERSION Prints the version information
--help Prints this help information
--man Prints the full documentation for mssh
=head1 DESCRIPTION
lib/App/MultiSsh.pm view on Meta::CPAN
my $tmux = '';
my $final = '';
my $pct = int( 100 / scalar @commands );
for my $ssh (@commands) {
if ( !$tmux && $option->{tmux_nested} ) {
$tmux = ' rename-window mssh';
$final =
'; bash -c '
. shell_quote(
"echo $ssh; echo 'set-window-option synchronize-panes on|off'")
. '\\;'
. shell_quote($ssh);
}
else {
my $cmd = !$tmux ? 'new-session' : '\\; split-window -d -p ' . $pct;
$tmux .=
" $cmd " . shell_quote("echo $ssh") . '\\;' . shell_quote($ssh);
}
}
my $sync = $option->{tmux_sync} ? 'on' : 'off';
$tmux .= " \\; set-window-option synchronize-panes $sync"
if $commands[0] !~ /\s$/xms;
return
"tmux$tmux \\; select-layout tiled \\; setw synchronize-panes $sync$final";
}
sub layout {
my (@commands) = @_;
my $rows = int sqrt @commands + 1;
my $cols = ceil @commands / $rows;
my $out = [];
if ( $cols > $rows + 1 ) {
my $tmp = $rows;
$rows++;
for my $no (0 .. $#data) {
my @test = map {'cmd' . ($_ + 1)} 0 .. $no;
my $ans = App::MultiSsh::layout(@test);
is_deeply $ans, $data[$no], ($no + 1) . " setup correctly"
or diag "$no\n", explain $ans, "\n", $data[$no];
}
}
sub test_tmux {
my @data = (
q{tmux new-session 'echo cmd1 '\;'cmd1 ' \\; select-layout tiled \\; setw synchronize-panes off},
q{tmux new-session 'echo cmd1 '\;'cmd1 ' \\; split-window -d -p 50 'echo cmd2 '\;'cmd2 ' \\; select-layout tiled \\; setw synchronize-panes off},
q{tmux new-session 'echo cmd1 '\;'cmd1 ' \\; split-window -d -p 33 'echo cmd2 '\;'cmd2 ' \\; split-window -d -p 33 'echo cmd3 '\;'cmd3 ' \\; select-layout tiled \\; setw synchronize-panes off},
q{tmux new-session 'echo cmd1 '\;'cmd1 ' \\; split-window -d -p 25 'echo cmd2 '\;'cmd2 ' \\; split-window -d -p 25 'echo cmd3 '\;'cmd3 ' \\; split-window -d -p 25 'echo cmd4 '\;'cmd4 ' \\; select-layout tiled \\; setw synchronize-panes off},
q{tmux new-session 'echo cmd1 '\;'cmd1 ' \\; split-window -d -p 20 'echo cmd2 '\;'cmd2 ' \\; split-window -d -p 20 'echo cmd3 '\;'cmd3 ' \\; split-window -d -p 20 'echo cmd4 '\;'cmd4 ' \\; split-window -d -p 20 'echo cmd5 '\;'cmd5 ' \\; selec...
);
for my $no (0 .. $#data) {
my @test = map {'cmd' . ($_ + 1).' '} 0 .. $no;
my $ans = App::MultiSsh::tmux({}, @test);
is_deeply $ans, $data[$no], ($no + 1) . " setup correctly"
or diag "$no\n", explain $ans, "\n", $data[$no];
}
}
( run in 0.299 second using v1.01-cache-2.11-cpan-0d8aa00de5b )