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

Introspection: Print associated project #668

Closed
guettli opened this issue Jan 10, 2024 · 3 comments
Closed

Introspection: Print associated project #668

guettli opened this issue Jan 10, 2024 · 3 comments
Labels

Comments

@guettli
Copy link

guettli commented Jan 10, 2024

TL;DR

hcloud project would be nice, so that you can see which project you are currently connected to (via HCLOUD_TOKEN).

We use many hcloud projects, and sometimes it is no clear which project you are connected to.

I think about creating a starship prompt integration, so that I see which hcloud project I am currently using.

But up to now there seems to be no way to get this information.

@phm07
Copy link
Contributor

phm07 commented Jan 11, 2024

Unfortunately the API does not offer a possibility to identify a token's parent project at the moment. However, you can probably achieve similar functionality by using contexts. You can create one context for each of your projects and then use hcloud context active to show your current context/project or hcloud context use to switch it.

@phm07 phm07 added the feature label Jan 11, 2024
@guettli
Copy link
Author

guettli commented Jan 11, 2024

@pauhull I would like to solve the underlying issue: Who is responsible for the API and how to contact this person?

@apricote
Copy link
Member

Hey @guettli, I have added a +1 on our internal feature request board for "GET current-project" endpoint.

Closing the issue, as the CLI can only implement endpoints that are available in the API.


PS. I also work with different projects & tokens regularly, so I added this to my oh-my-zsh prompt:

~ hc:(personal) which hcloud_ps1
hcloud_ps1 () {
	local HCLOUD_PS1
	HCLOUD_PS1_CONTEXT="$(hcloud context active)"
	HCLOUD_PS1+="%{$fg_bold[blue]%}hc:("
	HCLOUD_PS1+="%{$fg_bold[red]%}"
	HCLOUD_PS1+="${HCLOUD_PS1_CONTEXT}"
	HCLOUD_PS1+="%{$fg_bold[blue]%})%{$reset_color%}"
	echo "${HCLOUD_PS1}"
}
➜  ~ hc:(personal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants