Skip to content

Commit 9b62a5c

Browse files
author
Noah Gorny
authored
Merge pull request #1888 from clupasq/feature/powerline-command-duration
Add command duration to the powerline theme family
2 parents 8c47706 + 1e6113f commit 9b62a5c

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

docs/themes-list/powerline-base.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
7070
* ``battery`` - Battery information (you'll need to enable the ``battery`` plugin)
7171
* ``clock`` - Current time in ``HH:MM:SS`` format
7272
* ``cwd`` - Current working directory including full folder hierarchy (c.f. ``wd``\ )
73+
* ``duration`` - Duration of the last command. See :ref:`Command duration <command_duration>` for details.
7374
* ``gcloud`` - Current gcloud active account
7475
* ``hostname`` - Host name of machine
7576
* ``in_toolbox`` - Show identifier if running inside a `toolbox <https://github.com/containers/toolbox>`_

themes/powerline-multiline/powerline-multiline.theme.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
9494
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
9595
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "}
9696

97+
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
98+
9799
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"}
98100
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}
99101

themes/powerline/powerline.base.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ function __powerline_command_number_prompt() {
210210
echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}"
211211
}
212212

213+
function __powerline_duration_prompt() {
214+
local duration=$(_command_duration)
215+
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
216+
}
217+
213218
function __powerline_left_segment() {
214219
local params
215220
IFS="|" read -ra params <<< "${1}"

themes/powerline/powerline.theme.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
9191
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
9292
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "}
9393

94+
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
95+
9496
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
9597

9698
safe_append_prompt_command __powerline_prompt_command

0 commit comments

Comments
 (0)