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

Question: Using tmuxinator to open a dynamic number of windows #341

Closed
kylezeeuwen opened this Issue Oct 1, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@kylezeeuwen
Copy link

kylezeeuwen commented Oct 1, 2015

Not an issue more of a usage question not covered in the docs.

as asked here (answer there for reputation !!! :) ) : http://stackoverflow.com/questions/32878441/using-tmuxinator-to-open-a-dynamic-number-of-windows

I would like to set up a tmuxinator project to open a dynamic number of tmux windows. In my scenario I would like one window per instance in an AWS Auto Scale Group.

I have a bash function to list the private IP of each server I want to attach to. For example:

$ prod-ips
10.X.X.1
10.X.X.2
10.X.X.3
10.X.X.4

I have a bash function to tunnel to any of those IPs:

$tunnel_to 10.X.X.1
....
works
ec2-user@10.x.x.1 ~ $

How do I pass the IP list returned from prod-ips into a tmuxinator project so that it will open 1 window for each line of output ?

Thanks!

@kylezeeuwen kylezeeuwen changed the title Question: Question: Using tmuxinator to open a dynamic number of windows Oct 1, 2015

@ethagnawl

This comment has been minimized.

Copy link
Member

ethagnawl commented Nov 2, 2015

Since project files are first processed as ERB, you could do something like the following:

# ~/.tmuxinator/dyn.yml

name: dyn
root: ~/
windows:
  # just using `echo` as a POC; this is where you'd make your function call
  <%- `echo "111,222,333"`.split(',').each do |ip| %>
  - tunnel-to-<%= ip.chomp %>: echo tunnel_to <%= ip %>
  <%- end %>

2015-11-01-235053_1600x900_scrot

The docs do touch on this briefly, but it might also be useful to include an example which shows how to manipulate the project file's YAML structure.

@ethagnawl

This comment has been minimized.

Copy link
Member

ethagnawl commented Nov 16, 2015

@kylezeeuwen has marked this as resolved via StackOverflow.

@ethagnawl ethagnawl closed this Nov 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.