This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/Export.sh

65 lines
1.5 KiB
Bash
Raw Normal View History

2024-01-29 04:12:31 +03:00
# Set umask.
umask 077
2023-08-08 16:24:15 +03:00
# add all links in ~/app/bin/
2024-01-17 20:22:36 +03:00
export PATH=$( find -L ${HOME}/app/bin/ -type d -printf ":%p" 2> /dev/null ):${PATH}
2023-08-08 16:24:15 +03:00
# specify locale.
#export LC_ALL=C
export LANGUAGE="en_US.UTF-8"
# specify editor.
export EDITOR=nvim
# specify man page viewer.
export MANPAGER="nvim +Man!"
# specify android sdk root.
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
2024-01-25 15:07:04 +03:00
# specify java path.
export JAVA_HOME="${HOME}/app/java/x64/latest"
2023-08-08 16:24:15 +03:00
# specify tex paths.
#export TEXMFSYSVAR="$HOME/app/tex/data/var"
#export TEXMFSYSCONFIG="$HOME/app/tex/data/config"
2024-01-17 20:22:36 +03:00
export TEXMFVAR="${HOME}/app/tex/data/var"
export TEXMFCONFIG="${HOME}/app/tex/data/config"
export TEXMFLOCAL="${HOME}/app/tex/data/local"
2023-12-07 01:44:42 +03:00
# Dotfiles exports.
2023-12-07 04:02:47 +03:00
export BASH_MODULE_PATH="${HOME}/.config/bash/module"
2024-01-17 20:22:36 +03:00
2024-01-30 00:21:47 +03:00
# Docker config.
export DOCKER_CONFIG="${HOME}/.config/docker"
2024-01-17 20:22:36 +03:00
# Set java version. Sets to latest when not specified.
2024-01-25 15:07:04 +03:00
# Usage: export_java [VERSION]
2024-01-17 20:22:36 +03:00
function export_java() {
local version="${1}"
if [[ "${version}" = "" ]]; then
2024-01-25 15:07:04 +03:00
export JAVA_HOME="${HOME}/app/java/x64/latest"
return
2024-01-17 20:22:36 +03:00
fi
2024-01-25 15:07:04 +03:00
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}"
2024-01-17 20:22:36 +03:00
}
2024-01-25 15:07:04 +03:00
function _get_java_versions() {
ls "${HOME}/app/java/x64/" | grep "jdk_" | sed -e "s/.*_//" | sort -g 2> /dev/null
}
function _comp_java_versions() {
_autocomplete_first "$(_get_java_versions)"
}
complete -o nosort -F _comp_java_versions export_java