Merge pull request #697 from geniusupgrader/next

OpenFOAM support! (fixes #696)
This commit is contained in:
Ben Hilburn 2017-12-14 16:36:53 -05:00 committed by GitHub
commit 786dc5b3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -149,6 +149,7 @@ The segments that are currently available are:
* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file.
* `detect_virt` - Virtualization detection with systemd
* `newline` - Continues the prompt on a new line.
* `openfoam` - Shows the currently sourced [OpenFOAM](https://openfoam.org/) environment.
---------------------------------------------------------------------------------

View File

@ -1394,6 +1394,16 @@ prompt_pyenv() {
fi
}
prompt_openfoam() {
local wm_project_version="$WM_PROJECT_VERSION"
local wm_fork="$WM_FORK"
if [[ -n "$wm_project_version" ]] && [[ -z "$wm_fork" ]] ; then
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "OF: $(basename "$wm_project_version")"
elif [[ -n "$wm_project_version" ]] && [[ -n "$wm_fork" ]] ; then
"$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "F-X: $(basename "$wm_project_version")"
fi
}
# Swift version
prompt_swift_version() {
# Get the first number as this is probably the "main" version number..