Skip to content

Add subcommand to gp CLI for detecting if the command was run from Web-VSCode or Desktop-VSCode or other #11969

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

Closed
axonasif opened this issue Aug 8, 2022 · 5 comments
Labels
component: gp cli meta: 🤔 reporter-feedback-needed cannot process further since we need more info from the reporter team: IDE type: feature request New feature or request

Comments

@axonasif
Copy link
Member

axonasif commented Aug 8, 2022

Is your feature request related to a problem? Please describe

Such a shorthand subcommand would be useful for a use case such as:

  • On web, your webserver root address is something
  • But on desktop it may/could be different.
    So you could run something like gp which ide inside a script and decide upon the result to modify your environment.

Describe the behaviour you'd like

gp which ide tells you the IDE name.

Describe alternatives you've considered

if {
      pgrep -f 'sshd: gitpod@notty' \
        || pgrep -f "$HOME/.vscode-server/bin" \
        || test -e "$HOME/.ssh/authorized_keys";
} 1>/dev/null; then {
  printf '%s\n' "Gitpod on desktop";
  : "http://localhost:3000";
} else {
  printf '%s\n' "Gitpod on da web";
  : "$(gp url 3000)";
} fi

export HMR_HOST="$_"

Additional context

Please see these discord threads:

@akosyakov
Copy link
Member

I don't really understand the intent. Could you put what you want to solve not how?

I am not sure gp ide is great idea, we are allowing multiple IDEs running in the same workspace, you can start from web and desktop then or start from desktop and go back to web without restart in both cases.

@akosyakov akosyakov removed this from 🚀 IDE Team Aug 9, 2022
@akosyakov akosyakov added the meta: 🤔 reporter-feedback-needed cannot process further since we need more info from the reporter label Aug 9, 2022
@medihack
Copy link

The intent is to find out if a dev server is reachable using the localhost address (when using the desktop IDE, e.g. http://localhost:3000) or a Gitpod address (when using the browser IDE, e.g. https://for-bar-n2oi8b9a6wr.ws-eu60.gitpod.io/), because sometimes it's relevant for some developer tools.

@axonasif
Copy link
Member Author

Hey @akosyakov 👋

I don't really understand the intent. Could you put what you want to solve not how?

As @medihack as described above, we want to know which IDE/ssh server backends are running for use in scripts.

I am not sure gp ide is great idea, we are allowing multiple IDEs running in the same workspace, you can start from web and desktop then or start from desktop and go back to web without restart in both cases.

Great point 🙏
Now after thinking again, I guess instead of trying to detect the specific active backend, it could instead list names for all the running backends. So, one could do something like gp <special-command> | grep -q <ide-backend-name>.

Here's another use case:

  • Imagine you used the ssh command to connect to a workspace.
  • Later, you also attached to an task terminal: gp tasks attach <id>
    • But since the terminal was created earlier by supervisor, so it doesn't have the SSH_CONNECTION variable in it's environment, otherwise we could use that to detect in a script.

@akosyakov
Copy link
Member

akosyakov commented Aug 15, 2022

I think you are asking for #11849, i.e. you should run gp url <port> and it evaluates it in the context of last focused client and if a client can tunnel then gives you localhost:<port> otherwise exposed URL on internet.

@akosyakov
Copy link
Member

duplicate of #11849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: gp cli meta: 🤔 reporter-feedback-needed cannot process further since we need more info from the reporter team: IDE type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants