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

Improve "gp open" #598

Closed
meysholdt opened this issue May 31, 2019 · 10 comments
Closed

Improve "gp open" #598

meysholdt opened this issue May 31, 2019 · 10 comments
Labels
component: gp cli meta: stale This issue/PR is stale and will be closed soon

Comments

@meysholdt
Copy link
Member

Currently, we have terminal commands gp open and gp preview. I think they can be merged and improved.

idea:
gp open [flags] URL|FILE

with flags:
--browser opens URL in new browser tab
--preview-browser opens a URL in the Preview View
--editor opens a FILE in an editor
--preview-file opens a FILE in the in preview-readonly-editor, the one that renders markdown.

If no flags are provided, the default should be:

if $0 is file {
   gp open --editor
} else {
  gp open --preview-browser
}

Also, when a URL is provided, the command should check if it's pointing to localhost or an internal Ip address and if so, re-write the URL to its public format with the logic of gp url <port>. This would solve #596.

On second thought, gp open and gp preview have no intersecting functionality, so it may be better to keep them separate commands. However, the terminology does overlap, because we have a "preview" for files (the markdown renderer).

This could be solved by instead having the commands:
gp open FILE opens editor
gp open --preview FILE opens rendered markdown in read-only editor
gp browse URL opens preview view
gp browse --external URL opens URL in external browser window

@svenefftinge
Copy link
Member

I like the idea to reuse open. Also we should not open non-localhost (or workspace) http URLs in preview as they are most likely don't work.

@meysholdt
Copy link
Member Author

another idea: allow gp open [flags] PORT as a shortcut for gp open [flags] $(gp url PORT).

While there is the unlikely possibility that a number is a valid port and a valid file, this ambiguity can be resolved by specifying one of the [flags] that we already have. When a flag is specified, it's clear if a number should be translated into a URL or FILENAME.

@meysholdt
Copy link
Member Author

Should gp open also be able to focus folders/files in the File View?

I'd find this very useful when I navigated deep into some folder structure in the Terminal and want to continue in that context in the File View.

currently, I get

gp open .
2019/06/14 06:57:14 /workspace/foobar/node_modules/@theia/php is a directory - can only open files`

@meysholdt
Copy link
Member Author

Idea to use gp open also to open diffs: #678

@svenefftinge
Copy link
Member

We have gp preview for opening a URL in the preview. We could support an optional argument to tell it should open in a new tab, but it would be prohibited by browser's pop up blocker. So not sure how useful that is.

So the other options to gp open it would be good to align with the options from code (see here)

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Oct 4, 2020
@stale stale bot closed this as completed Mar 19, 2021
@axonasif
Copy link
Member

--preview-file opens a FILE in the in preview-readonly-editor, the one that renders markdown.

@shaal and many other users were looking for this feature.

@axonasif axonasif reopened this Jan 20, 2022
@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Jan 20, 2022
@shaal
Copy link
Contributor

shaal commented Jan 20, 2022

Thank you @axonasif
I can use this today gp preview $(gp url 8080), and it works as expected.
I am missing the control to open it as split screen, instead of taking the whole screen.

@axonasif
Copy link
Member

axonasif commented Jan 20, 2022

I wonder if we can have something for opening files from .gitpod.yml in the same manner as with terminals. Please create a new issue if you also have something like that in your mind @shaal

Although it would be great to have that control on the cli too!

@stale
Copy link

stale bot commented Apr 21, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Apr 21, 2022
@stale stale bot closed this as completed May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: gp cli meta: stale This issue/PR is stale and will be closed soon
Projects
None yet
Development

No branches or pull requests

4 participants