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

Passing command line arguments #67

Open
RobbHendershot opened this issue Jan 26, 2016 · 1 comment
Open

Passing command line arguments #67

RobbHendershot opened this issue Jan 26, 2016 · 1 comment

Comments

@RobbHendershot
Copy link

Is there any way to pass command line arguments through from invocation into a particular pane in the script? I would like to specify a server to ssh to using something like tmuxifier load-window debug servername and as part of the window creation pass the "servername" to ssh in a pane. Here is a test script I wrote -

new_window "debug"
split_h 30
split_v 50
run_cmd "htop"  2   # runs in active pane
run_cmd "sudo tail -f /var/log/messages" 3
run_cmd "echo vars :: $# :: $0 :: $1 :: $2 :: $3" 1
select_pane 1

Using the command above to invoke it I would expect "servername" to show up somewhere in the echo statement but I get nothing except the name of the window-

vars :: 1 :: /sysadmin/home/rdhender/.tmuxifier/libexec/tmuxifier-load-window :: debug :: ::  

I LOVE tmuxifier by the way, thank you for creating it!

@jimeh
Copy link
Owner

jimeh commented Jan 26, 2016

There's nothing like that at the moment, but you might be able to use environment variables. I've never tried this myself, though, so don't hold me to it :)

Basically invoke tmuxifier like so:

SERVERNAME=foobar tmuxifier load-window debug

And then do something like this in the window layout file:

run_cmd "echo $SERVERNAME"

If it works correctly, your new session will start with echoing foobar. Please let me know if it works or doesn't work :)

Off the top of my head I think it might at least work if the tmuxifier call actually starts a new tmux server, but if it's just connecting to an existing server I'm not sure if the env is forwarded.

I'll have a think about passing additional arguments to layout files. Off the top of my head I think it can get rather confusing and impractical when session layouts that themselves are loading window layouts are thrown into the mix though. We'll see :)

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

2 participants