Gitpod: [cli] Open "Preview" from the command line

Created on 2 Nov 2018  路  4Comments  路  Source: gitpod-io/gitpod

It would be handy if one could open a "Preview" view using the CLI. With this feature one could provide workspaces that "preconfigure" part of their views, e.g. to show/demo a service that was started after the build: yarn build && yarn run && gp preview $(gp url 8080)/myapp (for gp url see #126).

This command could be called

  • gp preview <url>
  • gp open-preview <url>
  • gp open preview <url>
  • gp view preview <url>
enhancement

All 4 comments

this should not only work for urls but also for local project files. They should be opened in the "mini-browser"

I'd also like this for a slightly different use-case: launching an oauth login to get secrets into my image without storing them in my git repo.

In my case I want to run gcloud auth login which uses python's webbrowser library to find a browser to use. With no way to open urls I have to manually copy and paste a url and code back and forth, where I should be able to quickly click through the oauth handshake.

Well, it didn't really help my use-case (Google didn't really like it when I rewrote the callback url to not be localhost), but I do have a sort of workaround for this.

https://gitlab.com/sherbang/gitpod-utils/tree/master

When you run gp_browser <url> it creates a one-use webserver. Gitpod notices the new open port and prompts if you want to "open preview" or "open browser". You click one of those, and the webserver serves you a page that redirects you to the URL of your choosing.

Clicking 1 button is far better than copy>pasting a url.

Cool! Btw. you could maybe avoid the manual click, by telling gitpod what to do onOpen see docs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nisarhassan12 picture nisarhassan12  路  3Comments

PatMyron picture PatMyron  路  3Comments

akosyakov picture akosyakov  路  3Comments

iksaif picture iksaif  路  3Comments

Kreyren picture Kreyren  路  3Comments