Add command duration to the powerline theme family
Fix the __powerline_duration_prompt: location & unused variable `prompt` Remove the duration segment from powerline* theme defaults Different color for duration prompt segmentpull/1888/head
parent
8c47706139
commit
1e6113f7b7
|
|
@ -70,6 +70,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
|
|||
* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin)
|
||||
* ``clock`` - Current time in ``HH:MM:SS`` format
|
||||
* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ )
|
||||
* ``duration`` - Duration of the last command. See :ref:`Command duration <command_duration>` for details.
|
||||
* ``gcloud`` - Current gcloud active account
|
||||
* ``hostname`` - Host name of machine
|
||||
* ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/toolbox>`_
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
|
|||
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
|
||||
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "}
|
||||
|
||||
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
|
||||
|
||||
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"}
|
||||
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,6 +210,11 @@ function __powerline_command_number_prompt() {
|
|||
echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_duration_prompt() {
|
||||
local duration=$(_command_duration)
|
||||
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
function __powerline_left_segment() {
|
||||
local params
|
||||
IFS="|" read -ra params <<< "${1}"
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
|
|||
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
|
||||
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "}
|
||||
|
||||
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
|
||||
|
||||
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
|
||||
|
||||
safe_append_prompt_command __powerline_prompt_command
|
||||
|
|
|
|||
Loading…
Reference in New Issue