Package: powerline-inject
powerline-injectpowerline-injectis aPowerlinestatus segment addon for showing ENV with extra knobs.This can be natively done withpowerline.segments.common.env.environmentif knobs aren't needed:{"segments":{"left":[{"function":"powerline.segments.common.env.environment","name":"aws","priority":20,"before":"⩜ ","args":{"variable":"SOME_ENV"}}]}}Couple knobs featured thatpowerline-injecthas are:The ability to toggle on or off the powerline-inject segment using an environment variable which can easily be mapped to a function in your~/.bash_profile.The ability to show only a symbol when the variables holds value. (SECRET KEYS, TOKENS, etc.)Multiple different highlighter profiles for your ENV lists.The screenshot below demonstrates this functionality:InstallationAdd the Python package.  powerline-inject is available on pypi so you can install it with pip:pipinstall--userpowerline-injectCreate a user configuration directory.Once powerline-inject has been installed, we'll need to add it to our powerline shell's theme and colorscheme.Alter your powerline user config:If you don't already have a~/.config/powerline/folder, create it. Next we'll be copying some of the default powerline configs into this location. Find where powerline is installed by usingpip show powerline-status | grep 'Location', then navigate to theconfig_files/folder there. We'll be copyingconfig.json,themes/shell/default.json, andcolorschemes/shell/default.jsonto our~/.config/powerline/folder, adding the necessary folders to match that original file structure (i.e. adding thethemes/andcolorschemes/folders, etc.Add powerline-inject to your user config.Within our user config, we'll need to add the powerline-inject segment to our shell by adding the following lines to our~/.config/powerline/themes/shell/default.json:{"function":"powerline_inject.context","priority":30,"args":{"show_env":true,"env_list":["AWS_PROFILE","TOKEN_X"]}}Next we'll add the highlighting colors we'll use to our~/.config/powerline/colorschemes/shell/default.json:{"name":"Default","groups":{"powerline_inject":{"fg":"white","bg":"red","attrs":[]},"powerline_inject_bold":{"fg":"white","bg":"brightred","attrs":[]},}}You will need to reload powerline withpowerline-daemon --replaceto load the new settings. That's it!(Optional) By default powerline-inject will render the environment variable ifRENDER_POWERLINE_INJECTSis either set toYESor is not set at all. Rather than setting this variable manually, you can create a simplepowerline-inject-togglefunction by placing the following in your~/.bash_profile:functionpowerline-injects-toggle(){if[[$RENDER_POWERLINE_INJECTS="NO"]];thenexportRENDER_POWERLINE_INJECTS="YES"elseexportRENDER_POWERLINE_INJECTS="NO"fi}Confidential ENV useYou may find you want to know when you haveSECRETSloaded into yourENVIRONMENT. This will show only a symbol⩜when theSECRET_TOKENorAWS_PROFILEis loaded.{"function":"powerline_inject.context","priority":30,"args":{"show_env":false,"env_list":["SECRET_TOKEN","AWS_PROFILE"],"before":"⩜ "}},You can further add a second call topowerline_inject.contextwith a differentbeforesymbol and/orenv_highlighterin args like thepowerline_inject_bolddefined above.{"function":"powerline_inject.context","priority":30,"name":"second_injection","args":{"show_env":false,"env_list":["SECRET_TOKEN","AWS_PROFILE"],"env_highlighter":"powerline_inject_bold"}},Used withPROMPT_COMMANDfor ENV refreshYou may want to use this with a PROMPT COMMAND that updates the ENVs being checked everytime. As an exampleaws-test-authenticationsetsAWS_EPOCHandAWS_PROFILE.Put this in your~/.bash_profileexportPROMPT_COMMAND="eval \$(aws-test-authentication);$PROMPT_COMMAND"You're all set up! Happy coding!LicenseLicensed under theApache License 2.0.Original fork is athttps://github.com/zcmarine/powerkube.