Skip to content

Allow passing multiple config files #165

@AsharLohmar

Description

@AsharLohmar

Hi @duncs
it's been a while :), these days I've found myself in need for a new feature so here it is.
As hinted in the title I'm talking about adding the possibility to call cssh with multiple config files. Actually it would more correct to say "enable" instead of "adding" because most of the functionality is already implemented :), all it took were these 2 little changes to make it work:

# diff Getopt.pm Getopt.pm.bkp.20240829
166c166
<         spec     => 'config-file|C=s@',
---
>         spec     => 'config-file|C=s',
365c365
<     $self->parent->config->load_configs( @{$self->config_file // []} );
---
>     $self->parent->config->load_configs( $self->config_file );

The thing is that I'm not a Perl dev and I'm a little too overwhelmed with work right now to do a propper pull request.

The use-case/the necessity for this feature might be a little too tied to my workflows but others could find usage too.
Specifically

  • I work on Windows from WSL and use VcXsrv for the X server, Like most other X servers (Xming, CygWIN's X, ...) when you work with multiple monitors they are treated as a single monitor and the windows get tiled on both monitors. So with this change I could(and do) pass config files with (only) different screen_reserve_* in order to have the windows tiled on one monitor  or the other
  • besides the ssh, I also have a few other tools that I use, for example an expect script that does ssh and all the initial password input & Co. (actually this is my default). Sometimes I need to use something else so (now) I can pass a config file to override only that

Now I'm having:

# ls ~/.clusterssh/ -1
config
config_left
config_right
config_ssh

and I am doing/can do stuff like:

cssh -C ssh -C left <...>
cssh -C ssh -C right <...>
cssh -C right <...>

(For everyone ... cssh will load it's default than override with whatever it finds in confg and then override with whatwever it find in the other file it receives from the command line, so the order is important.)

Anyway I hope I've managed to make myself understood  and maybe you'll find this useful enough to put it in your code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions