mirror of
https://github.com/duncs/clusterssh.git
synced 2025-04-21 09:09:06 +00:00
Add in auto_close functionality
Set whether terminal windows close after given numnber of seconds or wait until input given into terminal windows
This commit is contained in:
parent
23483ce362
commit
2b7ec74e6a
4 changed files with 28 additions and 5 deletions
10
bin/cssh
10
bin/cssh
|
@ -132,6 +132,10 @@ Run the command in each session, i.e. C<-a 'vi /etc/hosts'> to drop straight
|
|||
into a vi session. NOTE: not all communications methods support this (ssh
|
||||
and rsh should, telnet and console will not).
|
||||
|
||||
=item --autoclose,-A <seconds>
|
||||
|
||||
Number of seconds to wait before closing finished terminal windows.
|
||||
|
||||
=item --autoquit,-q|--no-autoquit,-Q
|
||||
|
||||
Enable|Disable automatically quiting after the last client window has closed
|
||||
|
@ -377,6 +381,12 @@ should be written as
|
|||
|
||||
Setting to anything other than C<yes> does not perform window tiling (see also -G).
|
||||
|
||||
=item auto_close = 5
|
||||
|
||||
Close terminal window after this many seconds. If set to 0 will instead wait
|
||||
on input from the user in each window before closing. Can be overridden
|
||||
by C<-K> on the command line
|
||||
|
||||
=item auto_quit = yes
|
||||
|
||||
Automatically quit after the last client window closes. Set to anything
|
||||
|
|
|
@ -108,6 +108,7 @@ my @options_spec = (
|
|||
'port|p=i',
|
||||
'autoquit|q',
|
||||
'no-autoquit|Q',
|
||||
'autoclose|K=i',
|
||||
'history|s',
|
||||
'term-args|t=s',
|
||||
'title|T=s',
|
||||
|
@ -1865,6 +1866,14 @@ sub run {
|
|||
= !$self->config->{use_all_a_records} || 0;
|
||||
}
|
||||
|
||||
if ( $options{action} ) {
|
||||
$self->config->{command} = $options{action} ;
|
||||
}
|
||||
|
||||
$self->config->{auto_quit} = "yes" if $options{autoquit};
|
||||
$self->config->{auto_quit} = "no" if $options{'no-autoquit'};
|
||||
$self->config->{auto_close} = $options{autoclose} if $options{'autoclose'};
|
||||
|
||||
$self->config->dump() if ( $options{'output-config'} );
|
||||
|
||||
$self->evaluate_commands() if ( $options{evaluate} );
|
||||
|
@ -2002,6 +2011,8 @@ the code until this time.
|
|||
|
||||
=item helper
|
||||
|
||||
=item cluster
|
||||
|
||||
=item create_menubar
|
||||
|
||||
=item create_windows
|
||||
|
|
|
@ -25,6 +25,9 @@ sub script {
|
|||
my $comms = $config->{comms};
|
||||
my $comms_args = $config->{$comms.'_args'};
|
||||
my $command = $config->{command};
|
||||
my $autoclose = $config->{auto_close};
|
||||
|
||||
my $postcommand = $autoclose ? "echo Press RETURN to continue; read IGNORE" : "sleep $autoclose";
|
||||
|
||||
# # P = pipe file
|
||||
# # s = server
|
||||
|
@ -116,7 +119,7 @@ sub script {
|
|||
\$command .= "\$svr";
|
||||
}
|
||||
}
|
||||
\$command .= " $command || sleep 5";
|
||||
\$command .= " $command ; $postcommand";
|
||||
warn("Running:\$command\\n"); # for debug purposes
|
||||
exec(\$command);
|
||||
HERE
|
||||
|
|
|
@ -39,6 +39,7 @@ Readonly::Hash my %default_config => {
|
|||
key_paste => "Control-v",
|
||||
mouse_paste => "Button-2",
|
||||
auto_quit => "yes",
|
||||
auto_close => 5,
|
||||
window_tiling => "yes",
|
||||
window_tiling_direction => "right",
|
||||
console_position => "",
|
||||
|
@ -185,10 +186,7 @@ is( $trap->leaveby, 'return', 'returned ok' );
|
|||
is( $trap->die, undef, 'returned ok' );
|
||||
isa_ok( $config, "App::ClusterSSH::Config" );
|
||||
is( $trap->stdout, q{}, 'Expecting no STDOUT' );
|
||||
{
|
||||
local $TODO = "deal with cluster definitions in config file";
|
||||
is( $trap->stderr, q{}, 'Expecting no STDERR' );
|
||||
}
|
||||
is( $trap->stderr, q{}, 'Expecting no STDERR' );
|
||||
|
||||
note('find_binary tests');
|
||||
my $path;
|
||||
|
@ -437,6 +435,7 @@ trap {
|
|||
};
|
||||
my $expected = <<'EOF';
|
||||
# Configuration dump produced by "cssh -u"
|
||||
auto_close=5
|
||||
auto_quit=yes
|
||||
console_position=
|
||||
debug=0
|
||||
|
|
Loading…
Add table
Reference in a new issue