Add π to the virtualenv title so I know that's what I see
Env
Pure 4.1.1 Fish fish, version 3.4.1 OS/distribution uname -a Darwin Seneca.fritz.box 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64
Problem description
I work with both virtualenvs as well as with Kubernetes a lot. Always correctly keeping track what virtualenv and what Kubernetes context and namespace is active, is really important to me.
To prevent all possible confusion, it would be very helpful if the virtualenv display could include the symbol π. This allows me to distinguish the Kubernetes context and namespace with βΈοΈ.
Proposed Solution
Would you accept a pull request for this? I have so far just edited my local config file to include this, but would like to be able to just update without having to care about this. A feature flag to hide this behind would be fine with me.
Hello @dwt, Sure, PRs are welcome :heart:
Suggestion
A variable defining the symbol for each indicator could do the trick, e.g declaring
_pure_set_default pure_symbol_virtualenv "π"
_pure_set_default pure_symbol_kubernetes "βΈοΈ"
By default, I would prefer having it empty for now, to have opt-in mechanism.
Could you try to update the test as well? They are still buggy when you run them all, but you should be able to run the one related to one feature, like:
β― make dev-pure-on FISH_VERSION=3.1.2 CMD="fishtape tests/_pure_prompt_virtualenv.test.fish"
Hm, that doesn't seem so easy, I'm getting hangs in the test suite with errors like this:
fish: Unknown command: _print_filename
/tmp/.pure/tests/migration-to-4.0.0.test.fish (line 1):
_print_filename $current_filename
^
in command substitution
called on line 2 of file /tmp/.pure/tests/migration-to-4.0.0.test.fish
/tmp/.pure/tests/migration-to-4.0.0.test.fish (line 2): Unknown command
@mesg (_print_filename $current_filename)
^
After that the test container just hangs indefinitely, until I manually kill the container. Any advice?
Scratch that, the problem was that I was running β― make test-pure-on FISH_VERSION=3.3.1 CMD="fishtape tests/_pure_prompt_virtualenv.test.fish" - which actually runs all the tests instead of restricting them.
I will add variable, so people can disable those features if need be:
_pure_set_default pure_enable_virtualenv true
_pure_set_default pure_enable_kubernetes true
@edouard-lopez were you able to make any progress on this? I too am looking for this (similar) functionality but honestly don't see k8s context support in the current code base. Was that a plugin you added or something else?
Hello @zonywhoop, no progress on my side @dwt was working on a PR, I believe.
However, I see two features in this issue:
- add a flag to control virtualenv display and add a customizable prefix (cf. functions/_pure_prompt_container.fish)
- add support for k8s context + customizable prefix. There are several prompts that offer k8s support, we can get inspired by them:
- https://github.com/aluxian/fish-kube-prompt
- https://github.com/jonmosco/kube-ps1
- https://github.com/Ladicle/fish-kubectl-prompt
I'm going to create another issue for the kubernetes one.
@dwt @zonywhoop K8s support has been shipped with https://github.com/pure-fish/pure/tree/v4.6.0
I'm working on the Python/virtualenv feature on #325