rok-prompt
... is a prompt for the rok
CLI by Immerok, built to be used with oh-my-zsh.
Dependencies
Installation
Install the plugin using
$ mkdir $ZSH_CUSTOM/plugins/rok
$ cp rok.plugin.zsh $ZSH_CUSTOM/plugins/rok
and then enable the plugin in your ~/.zshrc
. The plugin will automatically detect the location of your rok
configuration, but you can also manually specify it through ROK_CONFIG
(e.g., if you are using the development setup
and this invocation is too slow, or you just want to avoid it altogether).
plugins=(rok)
# Specify path to config to avoid 'rok version' invocation
# export ROK_CONFIG="/path/to/rok/config"
To use the default rok prompt, extend your prompt with rok_ps1
as shown below.
PROMPT=$PROMPT'$(rok_ps1)'
# If you prefer it to the right
# RPROMPT=$RPROMPT'$(rok_ps1)'
Customization
Default prompt
The colors of the default prompt (rok_ps1
) can be configured using the following environment variables. This uses
the built-in zsh colors
function.
$ROK_PS1_COLOR_TEXT
specifies the color for regular text.$ROK_PS1_COLOR_VALUE
specifies the color for values such as the Org or Project.$ROK_PS1_COLOR_MISSING
specifies the color for undefined values, e.g. if no default Project is set.
Furthermore, by default the prompt will only show the environment if it is not production. If you want to show the
environment regardless, or hide a different one (e.g. local
), you can set the following variable:
# Show all environments
export ROK_PS1_IGNORED_ENVIRONMENT=""
# Only show non-localhost environments
export ROK_PS1_IGNORED_ENVIRONMENT="local"
Custom prompt
Instead of using the built-in rok_ps1
prompt, you can also build a custom prompt. The following environment variables
will be set and updated:
$ROK_PS1_CONTEXT
$ROK_PS1_ORG
$ROK_PS1_PROJECT
$ROK_PS1_ENVIRONMENT