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

Add docker_context segment #1641

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

treuherz
Copy link

Adds docker_context segment to show current docker context, with
SHOW_ON_COMMAND and SHOW_DEFAULT parameters.

I hope submitting a PR for this is ok. I would have commented on the issue first but by the time I'd had a go to see if it seemed doable I was most of the way done!

I'm sure there are ways this could be more performant, any advice would be appreciated. docker context show is slow, ~100ms, so this is much faster when jq is available. I don't have a windows machine available to test whether it can find the config file ok on there, so that might need work.

Closes #1485

Adds docker_context segment to show current docker context, with
SHOW_ON_COMMAND and SHOW_DEFAULT parameters.

Closes romkatv#1485
@romkatv
Copy link
Owner

romkatv commented Nov 17, 2021

Thanks for submitting a PR.

This code is too slow for inclusion in powerlevel10k even when jq is available. If you want to use this segment, put it in your own config, rename prompt_docker_context to prompt_my_docker_context (to avoid clashes with future versions of p10k) and replace _p9k_prompt_segment with a call to p10k segment (see p10k help segment).

@treuherz
Copy link
Author

Understood, I appreciate you need to maintain high performance standards in here.

Even if it's not going to be merged, pointers on how to improve it would be great, but no worries if you don't have the bandwidth 👍

@romkatv
Copy link
Owner

romkatv commented Nov 17, 2021

I don't have the bandwidth. It'll take me less time to implement this segment than to explain how to implement it.

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

Successfully merging this pull request may close these issues.

feat: docker context support
3 participants