App-ClusterSSH

 view release on metacpan or  search on metacpan

lib/App/ClusterSSH/Getopt.pm  view on Meta::CPAN

            $self->loc('Toggle window tiling (overriding the config file).'),
    );
    $self->add_option(
        spec => 'term-args|t=s',
        help => $self->loc(
            'Specify arguments to be passed to terminals being used.'),
    );
    $self->add_option(
        spec     => 'title|T=s',
        arg_desc => 'title',
        help     => $self->loc(
            'Specify the initial part of the title used in the console and client windows.'
        ),
    );
    $self->add_option(
        spec => 'unique-servers|u',
        help => $self->loc(
            'Toggle connecting to each host only once when a hostname has been specified multiple times.'
        ),
    );
    $self->add_option(
        spec => 'use-all-a-records|A',
        help => $self->loc(
            'If a hostname resolves to multiple IP addresses, toggle whether or not to connect to all of them, or just the first one (see also config file entry).'
        ),
    );
    $self->add_option(
        spec => 'quiet|Q',
        help =>
            $self->loc('Do not output extra text when using some options'),
    );
    $self->add_option(
        spec     => 'cols|x=i',
        arg_desc => 'cols',
        help     => $self->loc('Number of columns'),
    );
    $self->add_option(
        spec     => 'rows|y=i',
        arg_desc => 'rows',
        help     => $self->loc('Number of rows'),
    );

    $self->add_option(
        spec => 'fillscreen',
        help => $self->loc(
            'Resize terminal windows to fill the whole available screen'),
    );

    return $self;
}

# For options common to ssh sessions
sub add_common_ssh_options {
    my ($self) = @_;

    $self->add_option(
        spec => 'options|o=s',
        help => $self->loc(
            'Specify arguments to be passed to ssh when making the connection.  B<NOTE:> options for ssh should normally be put into the ssh configuration file; see C<ssh_config> and F<$HOME/.ssh/config> for more details.'
        ),
        default => '-x -o ConnectTimeout=10',
    );

    return $self;
}

# For options that work in ssh, rsh type consoles, but not telnet or console
sub add_common_session_options {
    my ($self) = @_;

    $self->add_option(
        spec     => 'username|l=s',
        arg_desc => 'username',
        help     => $self->loc(
            'Specify the default username to use for connections (if different from the currently logged in user).  B<NOTE:> will be overridden by <user>@<host>.'
        ),
    );
    $self->add_option(
        spec     => 'action|a=s',
        arg_desc => 'command',
        help     => $self->loc(
            "Run the command in each session, e.g. C<-a 'vi /etc/hosts'> to drop straight into a vi session."
        ),
    );

    return $self;
}

sub getopts {
    my ($self) = @_;
    my $options = {};

    pod2usage( -verbose => 1 )
        if ( !GetOptions( $options, keys( %{ $self->{command_options} } ) ) );
    pod2usage( -verbose => 0 ) if ( $options->{'?'} || $options->{usage} );
    pod2usage( -verbose => 1 ) if ( $options->{'h'} || $options->{help} );
    pod2usage( -verbose => 2 ) if ( $options->{H}   || $options->{man} );

    # record what was given on the command line in case this
    # object is ever dumped out
    $self->{options_parsed} = $options;

    if ( $options->{'generate-pod'} ) {
        $self->_generate_pod;
        $self->exit;
    }

    if ( $options->{version} ) {
        print 'Version: ', $self->parent->VERSION, $/;
        $self->exit;
    }

    $options->{debug} ||= 0;
    $options->{debug} = 9 if ( $options->{debug} && $options->{debug} > 9 );

    # Now all options are set to the correct values, generate accessor methods
    foreach my $option ( sort keys( %{ $self->{command_options} } ) ) {

        # skip some accessors as they are already defined elsewhere
        next if $option =~ m/^(debug)\W/;

lib/App/ClusterSSH/Getopt.pm  view on Meta::CPAN

    );

    output '=item key_retilehosts = Alt-r';
    output $self->loc(
        q{Default key sequence to retile host windows.  See [_1] for more information.},
        'L<KEY SHORTCUTS>'
    );

    output '=item key_username = Alt-u';
    output $self->loc(
        q{Default key sequence to send username to client.  See [_1] for more information.},
        'L<KEY SHORTCUTS>'
    );

    output '=item macro_servername = %s';
    output '=item macro_hostname = %h';
    output '=item macro_username = %u';
    output '=item macro_newline = %n';
    output '=item macro_version = %v';
    output $self->loc(
        q{Change the replacement macro used when either using a 'Send' menu item, or when pasting text into the main console.}
    );

    output '=item macros_enabled = yes';
    output $self->loc(
        q{Enable or disable macro replacement.  Note: this affects all the [_1] variables above.},
        'C<macro_*>'
    );

    output '=item max_addhost_menu_cluster_items = 6';
    output $self->loc(
        q{Maximum number of entries in the 'Add Host' menu cluster list before scrollbars are used}
    );

    output '=item max_host_menu_items = 30';
    output $self->loc(
        q{Maximum number of hosts to put into the host menu before starting a new column}
    );

    output '=item menu_host_autotearoff = 0';
    output '=item menu_send_autotearoff = 0';
    output $self->loc(
        q{When set to non-0 will automatically tear-off the host or send menu at program start}
    );

    output '=item mouse_paste = Button-2 (middle mouse button)';
    output $self->loc(
        q{Default key sequence to paste text into the console window using the mouse.  See [_1] for more information.},
        'L<KEY SHORTCUTS>'
    );

    output '=item rsh = /path/to/rsh';
    output '=item ssh = /path/to/ssh';
    output '=item telnet = /path/to/telnet';
    output $self->loc(
        q{Set the path to the specific binary to use for the communication method, else uses the first match found in [_1]},
        'C<$PATH>'
    );

    output '=item rsh_args = <blank>';
    output '=item ssh_args = "-x -o ConnectTimeout=10"';
    output '=item telnet_args = <blank>';
    output $self->loc(
        q{Sets any arguments to be used with the communication method (defaults to ssh arguments).

B<NOTE:> The given defaults are based on OpenSSH, not commercial ssh software.

B<NOTE:> Any "generic" change to the method (e.g., specifying the ssh port to use) should be done in the medium's own config file (see [_1] and [_2]).},
        'C<ssh_config>', 'F<$HOME/.ssh/config>'
    );

    output '=item screen_reserve_top = 0';
    output '=item screen_reserve_bottom = 60';
    output '=item screen_reserve_left = 0';
    output '=item screen_reserve_right = 0';
    output $self->loc(
        q{Number of pixels from the screen's side to reserve when calculating screen geometry for tiling.  Setting this to something like 50 will help keep cssh from positioning windows over your window manager's menu bar if it draws one at that side...
    );

    output '=item terminal = /path/to/xterm';
    output $self->loc(q{Path to the X-Windows terminal used for the client.});

    output '=item terminal_args = <blank>';
    output $self->loc(
        q{Arguments to use when opening terminal windows.  Otherwise takes defaults from [_1] or [_2] file.},
        'F<$HOME/.Xdefaults>', 'F<$HOME/.Xresources>'
    );

    output '=item terminal_chdir = 0';
    output $self->loc(
        q{When non-0, set the working directory for each terminal as per '[_1]'},
        'L<terminal_chdir_path>'
    );

    output '=item terminal_chdir_path = $HOME/.clusterssh/work/%s';
    output $self->loc(
        q{Path to use as working directory for each terminal when '[_1]' is enabled.  The path provided is passed through the macro parser (see the section above on '[_2]'.},
        'L<terminal_chdir>', 'L<macros_enabled>',
    );

    output '=item terminal_font = 6x13';
    output $self->loc(
        q{Font to use in the terminal windows.  Use standard X font notation.}
    );

    output '=item terminal_reserve_top = 5';
    output '=item terminal_reserve_bottom = 0';
    output '=item terminal_reserve_left = 5';
    output '=item terminal_reserve_right = 0';
    output $self->loc(
        q{Number of pixels from the terminal's side to reserve when calculating screen geometry for tiling.  Setting these will help keep cssh from positioning windows over your scroll and title bars or otherwise overlapping the windows too much.}
    );

    output '=item terminal_colorize = 1';
    output $self->loc(
        q{If set to 1 (the default), then "-bg" and "-fg" arguments will be added to the terminal invocation command-line.  The terminal will be colored in a pseudo-random way based on the host name; while the color of a terminal is not easily predic...
    );

    output '=item terminal_bg_style = dark';
    output $self->loc(
        q{If set to [_1], the terminal background will be set to black and the foreground to the pseudo-random color.  If set to [_2], then the foreground will be black and the background the pseudo-random color.  If terminal_colorize is [_3], then t...

lib/App/ClusterSSH/Getopt.pm  view on Meta::CPAN

    output $self->loc(
        q{The following replacement macros are available (note: these can be changed in the configuration file):}
    );
    output '=over';
    output '=item %s';
    output $self->loc(
        q{Hostname part of the specific connection string to each client, minus any username or port}
    );
    output '=item %u';
    output $self->loc(
        q{Username part of the connection string to each client});
    output '=item %h';
    output $self->loc(q{Hostname of server where cssh is being run from});
    output '=item %n';
    output $self->loc(q{C<RETURN> code});
    output '=back';

    output $self->loc( q{B<NOTE:> requires [_1] to be installed},
        'L<XML::Simple>' );

    output '=back';

    output '=head1 ', $self->loc('KNOWN BUGS');
    output $self->loc(
        q{If you have any ideas about how to fix the below bugs, please get in touch and/or provide a patch.}
    );
    output '=over';
    output '=item *';
    output $self->loc(
        q{Swapping virtual desktops can cause a redraw of all the terminal windows.  This is due to a lack of distinction within Tk between switching desktops and minimising/maximising windows.  Until Tk can tell the difference between the two events...
    );
    output '=back';

    output '=head1 ', $self->loc('TROUBLESHOOTING');

    output $self->loc(
        q{If you have issues running [_1], first try:

[_2]

This performs two tests to confirm cssh is able to work properly with the settings provided within the [_3] file (or internal defaults).
}, $Script, 'C<< ' . $Script . ' -e [user@]<hostname>[:port] >>',
        'F<$HOME/.clusterssh/config>'
    );

    output '=over';
    output '=item 1';
    output $self->loc(
        q{Test the terminal window works with the options provided});
    output '=item 2';
    output $self->loc(
        q{Test [_1] works to a host with the configured arguments},
        $self->parent->config->{comms} );
    output '=back';

    output $self->loc(q{Configuration options to watch for in ssh are:});
    output '=over';
    output '=item *';
    output $self->loc(
        q{SSH doesn't understand [_1] - remove the option from the [_2] file},
        'C<-o ConnectTimeout=10>',
        'F<$HOME/.clusterssh/config>'
    );
    output '=item *';
    output $self->loc(
        q{OpenSSH-3.8 using untrusted ssh tunnels - use [_1] instead of [_2] or use [_3] in [_4] (if you change the default ssh options from [_5] to [_6])},
        'C<-Y>',
        'C<-X>',
        'C<ForwardX11Trusted yes>',
        'F<$HOME/.ssh/ssh_config>',
        'C<-x>',
        'C<-X>'
    );
    output '=back';

    output '=head1 ', $self->loc('SUPPORT AND REPORTING BUGS');

    output $self->loc(
        q{A web site for comments, requests, bug reports and bug fixes/patches is available at: [_1]},
        'L<https://github.com/duncs/clusterssh>'
    );

    output $self->loc(
        q{If you require support, please run the following commands and create an issue via: [_1]},
        'L<https://github.com/duncs/clusterssh/issues>',
    );
    output 'C<< perl -V >>';
    output q{C<< perl -MTk -e 'print $Tk::VERSION,$/' >>};
    output
        q{C<< perl -MX11::Protocol -e 'print $X11::Protocol::VERSION,$/' >>};
    output 'C<< cat /etc/csshrc $HOME/.clusterssh/config >>';

    output $self->loc(
        q{Using the debug option (--debug) will turn on debugging output.  Repeat the option to increase the amount of debug.  However, if possible please only use this option with one host at a time, e.g. [_1] due to the amount of output produced (i...
        'C<< cssh --debug <host> >>'
    );

    output '=head1 ', $self->loc('SEE ALSO');
    output $self->loc(
        q{L<https://github.com/duncs/clusterssh/wiki/>,
C<ssh>,
L<Tk::overview>,
L<X11::Protocol>,
C<perl>}
    );

    output '=head1 ', $self->loc('AUTHOR');
    output 'Duncan Ferguson, C<< <duncan_j_ferguson at yahoo.co.uk> >>';

    output '=head1 ', $self->loc('LICENSE AND COPYRIGHT');
    output $self->loc(
        q{
Copyright 1999-2018 Duncan Ferguson.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.
}
    );

    return $self;



( run in 0.313 second using v1.01-cache-2.11-cpan-4d50c553e7e )