-
Notifications
You must be signed in to change notification settings - Fork 423
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
Show Docker Context #621
Comments
This is different than #569 right? Docker context is similar to Kubernetes context, not about which container you are in. This is a valid request, and even better than you have included a suggested implementation. I don't know about using As with other features, this will have to wait until the rework is done, as Liquidprompt is currently too slow to accept any new features. Even disabled, each added feature will slow the prompt with how it works right now. But with an example implementation, this should be quick to implement. |
Correct; different issue to #569, and yes, similar to Kubernetes context I believe. Understood re rework; just wanted to follow the issue while I remembered. Also understand re |
Startup time of external commands will need to be compared. My guess is that |
Sorry for the radio silence on this. I do not want to use Unfortunately, So, using this: local context="$(docker context inspect)"
context="${context#*'"Name": "'}"
context="${context%%'",'*}" We can get the name of the context. It's hacky, but we don't need any external tools. Thoughts? |
I tend to try to avoid using hacky approaches like this, but I no longer use liquidprompt, so in this case I'm entirely indifferent. |
Thanks for the honest feedback. In that case, I will leave this open to see if it gathers other interest, but will not be working on a solution myself until then. |
Docker now features contexts which allow the user to use Docker setups on remote hosts etc. For people who use this, it's useful to list in the prompt what context is currently active, so they know which environment Docker commands will affect.
Description
The prompt should show, somewhere, the name of the current Docker context, if it's not the
default
context.How will this be useful?
To show which Docker environment will be affected by Docker commands
Example prompt
I'm not sure where best to display it, but somewhere in the prompt, with some appropriate symbol, display the text name of the current context. In the past, I've displayed this as
(🐳myContext)
, but not all terminals support emoji, so perhaps a new symbol makes sense.I've written some sample code to determine the current Docker context. If we're in the
default
context, the functions returns the empty string. Note thatjq
is required to parse the Docker config file, hence_lp_require_tool
.The text was updated successfully, but these errors were encountered: