Giter Club home page Giter Club logo

Comments (41)

jonmosco avatar jonmosco commented on August 23, 2024

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I basically tried the following 2 options:

export KUBE_PS1_CTX_COLOR="\[\033[0;35\]"
CTX_COLOR="$(echo -e '\033[0;35')"

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I'm using bash

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

This is actually an enhancement that I have to work on for bash. I am in the process of unifying the color handling so it will be the same for bash and zsh. I will label this as an enhancement for now.
This change should be in the next day or two as well.

Thanks again for making me aware of this issue and using kube-ps1.

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

Thanks, looking forward to it.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Try this new commit out and let me know if it does what you expect.

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I've just tried your new code but it seems to be behaving differently..
Without setting any colors explicitly by ENV variables, I'm getting the following prompt

(k8s|docker-for-desktop:default) » ~

instead of previously

(⎈ |docker-for-desktop:default) » ~

Before:
image

After:
image

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

1 bash 2018-02-03 17-54-43

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Oh, sorry, was looking at this on my phone. What is your $LANG set to?

echo $LANG

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024
(k8s|docker-for-desktop:default) » ~ echo $LANG
en_US.UTF-8

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Check out the README as well, you can now specify color names as mentioned, and depending on your setup, the color code can be used as well.

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I've tried with one of the color names but the color remained the same..
But I'll try with the codes instead.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Can you paste your config for kube-ps1 here? Bash version, etc as well.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

I suspect this is another bash < 4 issue. No echo -e, or printing with \u support, so I added hex codes for bash < 4. Try it out and let me know. If the colors are still and issue, the codes might need changed to.

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I actually have no specific config for kube-ps1, I only source your sh script and call the function in my prompt.

My bash version is as follows:

(k8s|docker-for-desktop:default) » ~ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I replaced my kube-ps1.sh script with the new version but the result was unfortunately the same.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Ok, well, we can try a couple more things. What does echo $KUBE_PS1_SHELL return?

The only reason k8s will appear is if it fails the shell check condition and doesn't print the symbols.

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024
(k8s|docker-for-desktop:default) » ~ echo $KUBE_PS1_SHELL
bash

It's strange because in the previous version of the code, the symbol would indeed print.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

That is strange. The only real difference is the usage of the actual symbol codes as opposed to putting the symbol itself in the script (this was done to support older versions of Bash).

Can you try to unset the KUBE_PS1_SYMBOL, then start a new shell and source the script again ? Perhaps the variable is not being overwritten correctly?

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

Something like this you mean ?

1 bash 2018-02-04 19-05-50

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

I am having trouble reproducing this on MacOS with iTerm2:

screen shot 2018-02-04 at 1 20 35 pm

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I've tried again with the script before I updated it with your changes regarding bash improvements.
The previous script seems to be working as expected.
But using the latest version seems to result in my errors.. Really strange...

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

can you paste echo $PS1

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024
(k8s|docker-for-desktop:default) » ~ echo $PS1
$(kube_ps1) \[\033[0;32m\]\302\273\[\033[0m\] \[\033[0;34m\]\w\[\033[0m\]\[\033[0m\]

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

This is a strange one indeed:

screen shot 2018-02-04 at 4 27 11 pm

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Can you try to start bash without your configuration, and source kube-ps1?

bash --norc
source /path/to/kube-ps1.sh
PS1='$(kube_ps1) \[\033[0;32m\]\302\273\[\033[0m\] \[\033[0;34m\]\w\[\033[0m\]\[\033[0m\] '

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Also, another question. Can you show me the output of echo trying to print the character:

$ echo -e $'\u2388'

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

1 bash 2018-02-05 19-39-15

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

This is weird because the first line where the cluster context is in fact red, it's when sourcing the kube-ps1.sh without the latest changes to bash colors...

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

What is the CTX color before and after:

echo $KUBE_PS1_CTX_COLOR

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Also, is there anything left over from your original question because you wanted it to be set to purple?

"I basically want to modify the context color from red to purple."

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

I wanted to easily customise the colours, yes.
But that's not working at the moment... I'll try to reproduce this in a clean environment because I have a lot of stuff in my bash environment, this to see if something else is causing this...
The behaviour is not consistent across multiple laptops which also suggests that it may be something local to my setup...

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Ok, just making sure something isn't left over from it previously is all.

What did you get for the output of echo $KUBE_PS1_CTX_COLOR ?

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

The output for that command is red.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Ok as it should be for the default, so its strange the purple color.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

Any luck?

from kube-ps1.

dieterdemeyer avatar dieterdemeyer commented on August 23, 2024

As a matter of fact, yes.
I started with a clean bash, and it seems to work fine with the latest version of the script.
So something must be messing it up with my current configuration.
I also noticed that the ENV variables need to be set before sourcing the script, which is obvious in retrospect...

I'll debug some more to find exactly what's causing the problem but the issue can be closed as far as I'm concerned.

Thanks for the help in debugging.

from kube-ps1.

jonmosco avatar jonmosco commented on August 23, 2024

No problem, thanks for using this project.

Also, the latest commit should fix the sourcing order problem for colors. Let me know.

from kube-ps1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.