warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.34k stars 372 forks source link

Ability to open and new tab and execute a command in the tab from the command line #3959

Open tmccormi opened 10 months ago

tmccormi commented 10 months ago

Discord username (optional)

No response

Describe the solution you'd like?

Would like to be able to launch the opening of several tabs with commands from the command line (like a bash script).

Example
open-all.sh
# Open all of my servers terminals via ssh

warp -tab-command "ssh me@my-server1.com"
warp -tab-command "ssh me@my-server2.com"
warp -tab-command "ssh me@my-server3.com"

Is your feature request related to a problem? Please describe.

I need to be able to quickly open a set of servers in separate tabs to respond to an issue or do a task that requires multiple terminals in tabs or split screens opened quickly (via ssh or AWS ssm, for instance).

Additional context

I was able to configure my OS to open a shell script from the file browser using Warp, but not as Tabbed sessions, alos having to use to UI to click in each shell script was icky.

How important is this feature to you?

3

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

None

dannyneira commented 10 months ago

Hi @tmccormi The best feature for this use case may be Launch Configurations, you can configure a set of tabs to open and then run any commands in those tabs, including ssh. Please see an example of this in our docs. https://docs.warp.dev/features/sessions/launch-configurations#commands Then, to open Launch configurations with a script, please take a look at Warps URI scheme as there is one for opening them with warp://launch/<launch_configuration_path>. https://docs.warp.dev/features/uri-scheme

Hope this helps with your use case, if not, then let us know what we can do differently.

vinit03 commented 10 months ago

Hey @tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there.

For example my launch configuration

name: Open Machines
windows:
  - tabs:
      - title: SSH Forward
        layout:
          cwd: /Users/vinit
          commands:
            - exec: ssh -i ~/mdoa ec2-user@111.111.111.111
            - exec: ssh -i "mdoa.pem" ubuntu@192.168.1.10
            - exec: sudo su
        color: blue
  - tabs:
      - title: SSH Forward
        layout:
          cwd: /Users/vinit
          commands:
            - exec: ssh -i ~/mdoa ec2-user@111.111.111.111
            - exec: ssh -i "mdoa.pem" ubuntu@192.168.1.11
            - exec: sudo su
        color: blue
tmccormi commented 10 months ago

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with.

On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.***> wrote:

Hey @tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there.

For example my launch configuration

name: Open Machines windows:

  • tabs:
    • title: SSH Forward layout: cwd: /Users/vinit commands:
      • exec: ssh -i ~/mdoa @.***
      • exec: ssh -i "mdoa.pem" @.***
      • exec: sudo su color: blue
  • tabs:
    • title: SSH Forward layout: cwd: /Users/vinit commands:
      • exec: ssh -i ~/mdoa @.***
      • exec: ssh -i "mdoa.pem" @.***
      • exec: sudo su color: blue

— Reply to this email directly, view it on GitHub https://github.com/warpdotdev/Warp/issues/3959#issuecomment-1866687111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC34N5NB7JBFATDNLMDYKRW3PAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWGY4DOMJRGE . You are receiving this because you were mentioned.Message ID: @.***>

vinit03 commented 10 months ago

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with. On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.> wrote: Hey @tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there. For example my launch configuration name: Open Machines windows: - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @. - exec: ssh -i "mdoa.pem" @. - exec: sudo su color: blue - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @. - exec: ssh -i "mdoa.pem" @. - exec: sudo su color: blue — Reply to this email directly, view it on GitHub <#3959 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC34N5NB7JBFATDNLMDYKRW3PAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWGY4DOMJRGE . You are receiving this because you were mentioned.Message ID: @.>

You need to create a file directly/manually. Warp will load it automatically. I'm using mac my save location is ~/.warp/launch_configurations/config.yaml

If a directory does not exists, create it. If a file does not exists, create it.

tmccormi commented 10 months ago

Ah, I see. Got it to work, thanks!

On Fri, Dec 22, 2023 at 3:36 AM Vinit Maniyar @.***> wrote:

I see, but I can't find anything that shows how you create these? There is "save new" in Launch Configs, but nothing about how to create it to begin with. … <#m6077327715731205955> On Thu, Dec 21, 2023 at 9:30 AM Vinit Maniyar @.> wrote: Hey @tmccormi https://github.com/tmccormi https://github.com/tmccormi https://github.com/tmccormi , I also have the same test case. In my case I created a launch configuration to ssh into the server. It works that's great. But I want to run commands on few of the server (on the servers after ssh) and not on my local machine. And in on of the tab after I ssh into a server, I want to ssh again to a different server from current one (SSH Tunneling) and execute some commands over there. For example my launch configuration name: Open Machines windows: - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @. - exec: ssh -i "mdoa.pem" @. - exec: sudo su color: blue - tabs: - title: SSH Forward layout: cwd: /Users/vinit commands: - exec: ssh -i ~/mdoa @.

You need to create a file directly/manually. Warp will load it automatically. I'm using mac my save location is ~/.warp/launch_configurations/config.yaml

If a directory does not exists, create it. If a file does not exists, create it.

— Reply to this email directly, view it on GitHub https://github.com/warpdotdev/Warp/issues/3959#issuecomment-1867583012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFZC5NW3L7YAXHQLZ67FLYKVWETAVCNFSM6AAAAABASLN2LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXGU4DGMBRGI . You are receiving this because you were mentioned.Message ID: @.***>

endersuu commented 8 months ago

The current solution is acceptable. It would be better if you put this solution to workflow section in Warp doc.

Elijas commented 7 months ago

related https://github.com/warpdotdev/Warp/issues/345 https://github.com/warpdotdev/Warp/discussions/612

eric-johnson-cp commented 6 months ago

On MacOS, the open command works to run commands in new tabs:

open -a warp "/path/script.sh"
open -a warp "/bin/ls" --args "~/Downloads"
Elijas commented 6 months ago

On MacOS, the open command works to run commands in new tabs:

open -a warp "/path/script.sh"
open -a warp "/bin/ls" --args "~/Downloads"

Works!!

gnegno84 commented 2 months ago

Can I use open to run a zsh script? I tried like open -a warp "/bin/zsh" --args "-i -c test" But it's not working (opening a subshell)

TeijiW commented 2 months ago

Is there a solution to open many tabs, but all in a split view? Like a tab in right side and another in left side.

jabbrahn commented 1 month ago

On MacOS, the open command works to run commands in new tabs:

open -a warp "/bin/ls" --args "~/Downloads"

Works!!

Does it really? For me it brings up Warp and executes the command /bin/ls (without arguments) in the directory /bin. Could you please verify? I'm running Warp v0.2024.09.10.08.02.stable_01 on macOS Sonoma 14.6.1 (23G93).