-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Run multiple commands in layouts #1099
Comments
Hey! Thanks for creating this issue! Yes, that is possible. |
I did not find how to run multiple commands or setting a working directory here, could you give me an example maybe ? |
Sure! Here is a small example:
|
hmmm I'm using bash at the moment and with the following layout: ---
tabs:
- name: Application
run:
command: {cmd: bash, args: ["-c cd /tmp && bash"]} But the only output I get is: $ zellij --layout-path ./zellij.yaml
Bye from Zellij! Maybe I did something wrong ? |
Every shell is different and I think this should work, but I don't use bash often:
|
@a-kenji I've just tested, and it doesn't work, neither with ---
tabs:
- name: Application
run:
command: "cd /tmp && exec bash" And it will be up to zellij to encapsulate it with the current shell " |
I tested it now and it does work for both bash and zsh for me.
Is there more information that you can maybe give me where it fails.
Maybe? I do want to have the ergonomics of the command improved. Especially on holding a pane open. I am not sure how feasible it is to integrate behavior that is very shell dependent. |
Just to make sure, did you have the arguments split like this:
? |
@a-kenji Yes, I have args splitted. But there are 2 things:
What is needed here, is to execute some command to prepare a pane for a project (installing dependancies, running containers, etc). |
Does this work:
? |
Yes, it works. Not optimal, but it does the job. Isn't is possible to plan to run a collection of commands instead of only one? |
Thanks, I will keep an eye on future updates. Meanwhile, I will use your trick to run some commands in a pane. Thanks a lot! cc @Korbeil sorry to squatting your issue, but I know we have the same issue 😄 |
No problem, it solved my issue so I'm glad you did :) Thank you both and thank for zellij @a-kenji ! |
If you're here and confused about the yaml layout, this is a how to do this in KDL: Bash:
Fish:
|
Had this issue, but when running as a command with a pipe. Here's how I eventually resolved it: > zrf --cwd "/mnt/c/Projects/mystuff" git ls-tree -r HEAD ./src/myproject | git hash-object --stdin
error: Found argument '--cwd /mnt/c/Projects/mystuff ...' which wasn't expected, or isn't valid in this context.
It seems zrf can't take --cwd since it's already an alias. Gonna have to be specific > zellij run -f --cwd "/mnt/c/Projects/mystuff" git ls-tree -r HEAD ./src/myproject | git hash-object --stdin
The pipe caused the last part to be considered outside my zellij command 🥹 Need to encapsulate it > zellij run -f --cwd "/mnt/c/Projects/mystuff" "git ls-tree -r HEAD ./src/myproject | git hash-object --stdin"
error: Found argument 'git ls-tree -r HEAD ./src/myproject | git hash-object --stdin' which wasn't expected, or isn't valid in this context
Command needs to come after > zellij run -f --cwd "/mnt/c/Projects/mystuff" -- "git ls-tree -r HEAD ./src/myproject | git hash-object --stdin"
Command not found: git ls-tree -r HEAD ./src/myproject | git hash-object --stdin
If you were including arguments as part of the command, try including them as 'args' instead.
> zellij run -f --cwd "/mnt/c/Projects/mystuff" -- zsh -c "git ls-tree -r HEAD ./src/myproject | git hash-object --stdin"
Works! 👍 |
Hey,
I would like to create layout for my projects but to do that I need to run multiple commands.
For example here is a script I'm running when starting a project:
First part could be removed if we add a
cwd
configuration in the layout parts section.For the 2 last lines I would need to run multiple commands, do you think that is possible ?
Thanks for the awesome tool :)
The text was updated successfully, but these errors were encountered: