App-Xssh

 view release on metacpan or  search on metacpan

bin/xssh  view on Meta::CPAN

	xssh --version

=head1 DESCRIPTION

This program will allow you to ssh to a remote host inside a new X Terminal
window (like XTerm).  

The idea here is that each time you ssh to a particular host, a terminal
window will be launched with a consistent customised appearance.  For
example, you may wish to configure 'prodserver' so the terminal window
background is a redish colour - reminding you to tread very carefully...

=head1 OPTIONS

=over

=item B<--sethostopt> HOST OPTION VALUE

Set or update a host option and save it to the config file.

A host option defines an attribute that will always apply when you refer

bin/xssh  view on Meta::CPAN


=back

=head1 EXAMPLES

First, you may like to define some defualts that will apply to all the
remote servers you might log in to.

	xssh --sethostopt DEFAULT scrollback 1024
	xssh --sethostopt DEFAULT foreground blue
	xssh --sethostopt DEFAULT background white

Then you may like to override those defaults for some specific hosts.

	xssh --sethostopt favourite foreground green
	xssh --sethostopt favourite background black
	xssh --sethostopt favourite geometry 128x70

You may then get bored with setting all options for all hosts, so you
might want to set up some "profile" options.

	xssh --setprofileopt prod foreground black
	xssh --setprofileopt prod background IndianRed

You would then define which hosts take those profile options.

	xssh --sethostopt important profile prod

FINALLY, you can use xssh to log in to those servers

	# Log in to the server "important" - you'll get a new xterm
	# window with a redish background, black text, 1024 lines of
	# scrollback
	xssh important
	
	# Log in to the server "unknown" - you'll get a new xterm window
	# with a white background, blue text, 1024 lines of scrollback
	xssh unknown
	
	# Log in to the server "favourite" - you'll get a new xterm
	# window with a black background, green text, 1024 lines of
	# scrollback, and a larger terminal
	xssh favourite

=head1 FILES

=over

=item F<$HOME/.xsshrc>

This file contains all the configuration for xssh.  It is in

t/20-app-xssh.t  view on Meta::CPAN


# Arrange for a safe place to play
$ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );

my $xssh = App::Xssh->new();

# Mess with the config data
my $c = App::Xssh::Config->new();
ok($xssh->setValue($c,"profile","testprofile","attribute","red"), "setprofile profile");
ok($xssh->setValue($c,"hosts","testhost","foreground","red"), "sethost foreground");
ok($xssh->setValue($c,"hosts","DEFAULT","background","red"), "sethost default background");
ok($xssh->setValue($c,"hosts","testhost","profile","testprofile"), "sethost testhost profile");

# Test whether the config options taken hold
my $c2 = App::Xssh::Config->new();
my $options = $xssh->getTerminalOptions($c2,"testhost");
is($options->{foreground}, "red", "host option found");
is($options->{background}, "red", "default option found");
is($options->{attribute}, "red", "profile option found");

# test if showConfig returns the same information
my $str = $c2->show();
like($str, qr/foreground.*red/, "showconfig() contains similar data");

# Just in case all the above isn't really testing anything
isnt($options->{foreground}, "blue", "control test");

done_testing();

t/21-app-xssh--multiple-profiles.t  view on Meta::CPAN

use App::Xssh::Config;

# Arrange for a safe place to play
$ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );

my $xssh = App::Xssh->new();
my $config = App::Xssh::Config->new();

# Create some profile attributes to define the FG/BG
$config->add(["profile","local","foreground"],"red");
$config->add(["profile","trusted","background"],"red");

# Create a host entry that references both profile attributes
$config->add(["hosts","testhost","profile"],"local,trusted");

# See that the attribute contains the FG and the BG options
my $options = $xssh->getTerminalOptions($config,"testhost");
ok($options->{foreground} eq "red", "foreground option");
ok($options->{background} eq "red", "background option");

done_testing();



( run in 0.530 second using v1.01-cache-2.11-cpan-0b5f733616e )