1
0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-12 19:18:28 +02:00

Merge pull request #127 from dritter/go_prompt

Adding Go version segment.
This commit is contained in:
Ben Hilburn 2015-10-21 16:51:44 -07:00
commit 981c85af39
2 changed files with 11 additions and 0 deletions

View File

@ -73,6 +73,7 @@ The segments that are currently available are:
* [aws](#aws) - The current AWS profile, if active. * [aws](#aws) - The current AWS profile, if active.
* [context](#context) - Your username and host. * [context](#context) - Your username and host.
* [dir](#dir) - Your current working directory. * [dir](#dir) - Your current working directory.
* **go_version** - Show the current GO version.
* **history** - The command number for the current line. * **history** - The command number for the current line.
* [ip](#ip) - Shows the current IP address. * [ip](#ip) - Shows the current IP address.
* **load** - Your machines 5 minute load average. * **load** - Your machines 5 minute load average.

View File

@ -647,6 +647,16 @@ prompt_dir() {
"$1_prompt_segment" "$0" "blue" "$DEFAULT_COLOR" "$(print_icon 'HOME_ICON')$current_path" "$1_prompt_segment" "$0" "blue" "$DEFAULT_COLOR" "$(print_icon 'HOME_ICON')$current_path"
} }
# GO-prompt
prompt_go_version() {
local go_version
go_version=$(go version 2>&1 | grep -oe "^go[0-9.]*")
if [[ -n "$go_version" ]]; then
"$1_prompt_segment" "$0" "green" "255" "$go_version"
fi
}
# Command number (in local history) # Command number (in local history)
prompt_history() { prompt_history() {
"$1_prompt_segment" "$0" "244" "$DEFAULT_COLOR" '%h' "$1_prompt_segment" "$0" "244" "$DEFAULT_COLOR" '%h'