hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Use Hyper CLI to open multiple windows and tabs with configuration

Open zanedev opened this issue 9 years ago • 46 comments

It could be nice to launch HyperTerm with a few tabs and run a few scripts in each one automatically. Like a project configuration. Is that possible now?

zanedev avatar Jul 27 '16 16:07 zanedev

It's not build into hyperterm at the moment. You could write a plugin for it though 👍 You mean kind of like iTerm2's profiles right?

timneutkens avatar Jul 27 '16 19:07 timneutkens

Maybe even simpler, rather than full fledged profiles at first. Like the ability to launch a command to a new tab in the current window. I imagine it would be reused as a command line launcher in general but maybe if it's called from hyperterm it launches a new tab, if it's called outside hyperterm it launches hyperterm with that command. The hyperterm app doesn't seem to accept command line arguments currently as far as I can tell...

Sure it would be fun! I've never worked with electron but would like to get into it. Any ideas to point in the right direction would help.

zanedev avatar Jul 27 '16 20:07 zanedev

Hmm that would be a cool idea.. like a echo 'example' | hyperterm which opens a new tab and executes the command passed in. Same goes for hyperterm "echo 'example'" Maybe if you're a little crazy you could hook into that and add the hyperhyper command which does the same with this soundbit https://www.youtube.com/watch?v=F7aKqJsuPDg :joy: :joy: echo 'example' | hyperhyper

timneutkens avatar Jul 27 '16 21:07 timneutkens

I imagine it would need to be like textmate or webstorm where we'd bundle a separate command line tools binary/script that can be optionally installed in the path. Or maybe that's overkill it could be simpler to just pass params to the app living in Applications.

zanedev avatar Jul 27 '16 22:07 zanedev

Hey, guys – any update to this in Hyper? I was hoping for something even as simple as the ability to open Hyper.app from the command line. Not necessary pass a command into it.

Is that possible? I know you can just run: open "/Applications/Hyper.app"

But that launches a new instance every time. Instead, is there a way to have it launch and open a new instance if it's not already running (and only launch a new window if it is already running)?

austin-guevara avatar Nov 08 '16 19:11 austin-guevara

At work we use scripts to open new tabs in Konsole that SSH into the various servers we deploy and test on (about a 100 different servers). The background colors (actually the profiles) are different for different environment types. For example:

konsole --new-tab --profile Test -e ssh someserver.ourdomain.com

If this was possible in Hyper I would switch.

thrkmmr avatar Dec 13 '16 15:12 thrkmmr

I noticed that one can run /Application/Hyper.app/Contents/MacOS/Hyper /path/to/directory to open a new instance of the app, with the given path as the working directory, but that's as far as it goes. Also it shows up in alt-tab etc. as a separate app which is not very handy.

ilkka avatar Feb 11 '17 10:02 ilkka

The trouble with passing a directory or command to the executable on the command line is that new windows created from that session seem to "inherit" those properties. So for example, if you open a window using /Application/Hyper.app/Contents/MacOS/Hyper /path/to/directory and then create a new window, it will also open in that directory. The Windows alt-tab and macOS dock will see this instance as a different application if Hyper was already running with no (or different) arguments. I'm unfamiliar with Electron or the Hyper code to see if this is something that can be fixed - such that different instances launched with different command line arguments are grouped together as the same application. I also think it is worth considering a separate command line utility with the ability to hook into the running app the create new windows and run commands, etc - but again, I'm not familiar enough with the technologies here to know if this is naive.

rmwaite avatar Feb 22 '17 18:02 rmwaite

Having a .hyperproj file to launch pre configured tabs would be extremely useful, any progress on this?

borela avatar Apr 29 '17 18:04 borela

This is in my long task list to enable profile accessibility!

ppot avatar Apr 29 '17 22:04 ppot

There is a typo in @ilkka and @richardwaite comments: it is /Applications/Hyper.app/Contents/MacOS/Hyper /path/to/directory. That is quite handy if you want to open hyper over GitKraken.

dsturm avatar May 05 '17 08:05 dsturm

@borela that seems perfect for a plugin!

albinekb avatar May 05 '17 09:05 albinekb

Would enable many use cases: such as allowing sftp programs to launch hyper for SSH, a support for a myriad of "cd_to" like tools (that also work from any application), etc.

I'm a little surprised that hyper doesn't support any command line arguments - since it's application can be categorized as command line tool (to some extent) !

Alternatively I could just fork and make my own hyper version, but I would love official update support :(

tkodev avatar Sep 06 '17 20:09 tkodev

Indeed you could just fork and make your own hyper version... ...and make a PR to have this in an official update 😄

chabou avatar Sep 06 '17 21:09 chabou

@richardwaite @dsturm @ilkka Thanks /Applications/Hyper.app/Contents/MacOS/Hyper /path/to/directory Works as expected.

Royedc4 avatar Sep 08 '17 17:09 Royedc4

New tab support would be great, along with kicking off a command to start. I have this scripted out (via applescript) in Terminal.app. But its ugly. I'd want to run a script called "dev/start" in my project that looks something like this:

#!/usr/bin/env bash

hyper --tab --title "Server" --script "cd $HOME/myProject/server && bundle exec rails s"
hyper --tab --title "Console" --script "cd $HOME/myProject/server && bundle exec rails c"
hyper --tab --title "Specs" --script "cd $HOME/myProject/server && bundle exec guard"
hyper --tab --title "Frontend" --script "cd $HOME/myProject/frontend && bundle exec middleman start"

That would open up 4 tabs automatically, name them, and then kick off a script for each

I'm totally open to alternative ways of doing it also. But the end result should be 4 named tabs with 4 different processes.

Thanks!

jacquescrocker avatar Apr 21 '18 18:04 jacquescrocker

Woops, I didn't totally understand the issue 🙈

I'll change the title to be more accurate to the new hyper CLI 👌

timothyis avatar Apr 22 '18 01:04 timothyis

I feel compelled to write in to describe my use case for this functionality. I currently have PowerShell functions that open new tabs in ConEmu and establish new ssh.exe, mysql, psql (Postgres), sqlcmd (SQL Server), sqlplus (Oracle), and other connections. In my PowerShell profile, I also have a function that reads in all the servers and databases from a CMDB at startup and creates aliases for them. That allows me to start typing the name of a system, tab complete it, press enter, and get a new tab with an SSH, database, or other connection, etc.

If the hyper cli gets a function that lets me create tabs from the command line and I can use arbitrary shells with hyper, then I think a lot of SysAdmin/DBA types would be interested in hyper.

elijahgagne avatar Apr 23 '18 19:04 elijahgagne

New tab support would be great, along with kicking off a command to start. I have this scripted out (via applescript) in Terminal.app. But its ugly. I'd want to run a script called "dev/start" in my project that looks something like this:

#!/usr/bin/env bash

hyper --tab --title "Server" --script "cd $HOME/myProject/server && bundle exec rails s"
hyper --tab --title "Console" --script "cd $HOME/myProject/server && bundle exec rails c"
hyper --tab --title "Specs" --script "cd $HOME/myProject/server && bundle exec guard"
hyper --tab --title "Frontend" --script "cd $HOME/myProject/frontend && bundle exec middleman start"

That would open up 4 tabs automatically, name them, and then kick off a script for each

I'm totally open to alternative ways of doing it also. But the end result should be 4 named tabs with 4 different processes.

Thanks!

This is totally what I am looking for. Guake Terminal has something very similar to this and I have a terminal starter script that i run after system start. This is very helpful and preps your terminal session for your work.

volumetric avatar Sep 19 '18 05:09 volumetric

Working on micro-services I sometimes have 4 different servers to start before testing my code. Just telling them all to start in different tabs would be amazing!

dewetblomerus avatar Oct 05 '18 08:10 dewetblomerus

@dewetblomerus, take a look on this: https://github.com/zerdos/modern-web-app-skeleton/blob/master/.hyperlayout

zerdos avatar Oct 06 '18 19:10 zerdos

New tab support would be great, along with kicking off a command to start. I have this scripted out (via applescript) in Terminal.app. But its ugly. I'd want to run a script called "dev/start" in my project that looks something like this:

#!/usr/bin/env bash

hyper --tab --title "Server" --script "cd $HOME/myProject/server && bundle exec rails s"
hyper --tab --title "Console" --script "cd $HOME/myProject/server && bundle exec rails c"
hyper --tab --title "Specs" --script "cd $HOME/myProject/server && bundle exec guard"
hyper --tab --title "Frontend" --script "cd $HOME/myProject/frontend && bundle exec middleman start"

That would open up 4 tabs automatically, name them, and then kick off a script for each

I'm totally open to alternative ways of doing it also. But the end result should be 4 named tabs with 4 different processes.

Thanks!

I would expect that with electron being slow to startup, there would be a need for some launcher app to track these and wait until the GUI app fully executes

pcnate avatar Nov 02 '18 16:11 pcnate

I would like to try writing this plugin. Does the api provide the necessary to hook such option on start, or is a fork required ?

lou-bi avatar Nov 09 '18 18:11 lou-bi

I'd definitely love to see this feature come to life :+1:, I really love Hyper and this would bring it to perfection for me

Circuit8 avatar Nov 14 '18 10:11 Circuit8

Curious about the answer to @BonLouis's comment, as well as, justification/reasoning on why this should be a plugin instead of a built in feature? Are enough of the hyper internals exposed for this to be a plugin? Thanks!

taylorjdawson avatar Jan 21 '19 20:01 taylorjdawson

I think that Hyperlayout plugin does exactly what you want :)

chabou avatar Jan 21 '19 20:01 chabou

Hmm interesting seems to do what everyone is asking for? What's missing from the Hyperlayout plugin that doesn't resolve this issue?

taylorjdawson avatar Jan 21 '19 20:01 taylorjdawson

Interesting. I'll have to try that out later on

pcnate avatar Jan 21 '19 21:01 pcnate

Some things I'd like that might not be included in the Hyperlayout plugin are:

  1. Ability to create a layout that uses different shells (e.g. PowerShell, Bash, cmd.exe)
  2. Ability to create a layout by passing parameters (without creating/editing a file)

To elaborate on (2), for example, I'd create a Bash or PowerShell function that takes a parameter for the server name. When the function is called, it creates a new tab, runs ssh, and passes in all the relevant paraments to connect to a server. It seems that hyperlayout could do this, but would require creating files. I wouldn't want to do this, especially because the files might contain credentials.

I only skimmed Hyperlayout so I could have easily missed that it covers 1 and/or 2.

elijahgagne avatar Jan 21 '19 21:01 elijahgagne

1 I think this feature can be added to Hyperlayout 2 We need to add ability to Hyper to pass CLI args to plugins.

I really don't think it should be a core feature but Hyper should definitely make this feature possible with plugins.

chabou avatar Jan 22 '19 20:01 chabou