Export : Add export_java.
This commit is contained in:
parent
53f2474968
commit
55348a9e12
|
@ -1,5 +1,5 @@
|
|||
# add all links in ~/app/bin/
|
||||
export PATH=$( find -L $HOME/app/bin/ -type d -printf ":%p" 2> /dev/null ):$PATH
|
||||
export PATH=$( find -L ${HOME}/app/bin/ -type d -printf ":%p" 2> /dev/null ):${PATH}
|
||||
|
||||
# specify locale.
|
||||
#export LC_ALL=C
|
||||
|
@ -12,7 +12,7 @@ export EDITOR=nvim
|
|||
export MANPAGER="nvim +Man!"
|
||||
|
||||
# specify java path.
|
||||
export JAVA_HOME="$HOME/app/java/x64/jdk_11"
|
||||
export JAVA_HOME="${HOME}/app/java/x64/latest"
|
||||
|
||||
# specify android sdk root.
|
||||
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
|
||||
|
@ -20,9 +20,39 @@ export ANDROID_SDK_ROOT="$HOME/.android/sdk"
|
|||
# specify tex paths.
|
||||
#export TEXMFSYSVAR="$HOME/app/tex/data/var"
|
||||
#export TEXMFSYSCONFIG="$HOME/app/tex/data/config"
|
||||
export TEXMFVAR="$HOME/app/tex/data/var"
|
||||
export TEXMFCONFIG="$HOME/app/tex/data/config"
|
||||
export TEXMFLOCAL="$HOME/app/tex/data/local"
|
||||
export TEXMFVAR="${HOME}/app/tex/data/var"
|
||||
export TEXMFCONFIG="${HOME}/app/tex/data/config"
|
||||
export TEXMFLOCAL="${HOME}/app/tex/data/local"
|
||||
|
||||
# Dotfiles exports.
|
||||
export BASH_MODULE_PATH="${HOME}/.config/bash/module"
|
||||
|
||||
# Set java version. Sets to latest when not specified.
|
||||
# Usage: export_java [VERSION]
|
||||
function export_java() {
|
||||
local version="${1}"
|
||||
|
||||
if [[ "${version}" = "" ]]; then
|
||||
export JAVA_HOME="${HOME}/app/java/x64/latest"
|
||||
return
|
||||
fi
|
||||
|
||||
local available=($(_get_java_versions))
|
||||
|
||||
if ! _contains ${version} ${available[@]}; then
|
||||
_error "Version ${version} is not available."
|
||||
return 1
|
||||
fi
|
||||
|
||||
export JAVA_HOME="${HOME}/app/java/x64/jdk_${version}"
|
||||
}
|
||||
|
||||
function _get_java_versions() {
|
||||
ls "${HOME}/app/java/x64/" | grep "jdk_" | sed -e "s/.*_//" | sort -g
|
||||
}
|
||||
|
||||
function _comp_java_versions() {
|
||||
_autocomplete_first "$(_get_java_versions)"
|
||||
}
|
||||
|
||||
complete -o nosort -F _comp_java_versions export_java
|
||||
|
|
|
@ -137,6 +137,12 @@ Command|Description
|
|||
---|---
|
||||
`doc_bash`|Generate a markdown file with all the help info. Outputs to `~/.doc/Bash.md`.
|
||||
|
||||
## Export.
|
||||
|
||||
Command|Description
|
||||
---|---
|
||||
`export_java [VERSION]`|Set java version. Sets to latest when not specified.
|
||||
|
||||
## Ffmpeg.
|
||||
|
||||
Command|Description
|
||||
|
|
Reference in a new issue