Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing multiple config files #165

Open
AsharLohmar opened this issue Jan 9, 2025 · 0 comments
Open

Allow passing multiple config files #165

AsharLohmar opened this issue Jan 9, 2025 · 0 comments

Comments

@AsharLohmar
Copy link
Contributor

AsharLohmar commented Jan 9, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant