# Bash and Zsh common env var settings. -*- sh -*-

# set -x
# set -u

export DEBFULLNAME='Oleksandr Gavenko'
export DEBEMAIL='gavenkoa@gmail.com'

export EDITOR=vim

# XXX vim and gnome-terminal have support for 256 colours in fedora 8 at least
# Note debian/ubuntu users should install the ncurses-term package to support this
# export TERM=xterm-256color

if [[ $OSTYPE = cygwin ]]; then
  # Avoid permission problem in Cygwin.
  umask 0000
fi

export TIME_STYLE=long-iso

# Easy cd to often used dirs.
export CDPATH=.:$HOME:$HOME/devel:$HOME/my

if [[ :$PATH: != *:$HOME/usr/bin:* ]]; then
  export PATH=$PATH:$HOME/usr/bin
fi
if [[ :$PATH: != *:/usr/sbin:* ]]; then
  export PATH=/usr/sbin:$PATH
fi
if [[ :$PATH: != *:/sbin:* ]]; then
  export PATH=/sbin:$PATH
fi
if [[ :$PATH: != *:/usr/local/bin:* ]]; then
  export PATH=$PATH:/usr/local/bin
fi
# ~/.local/bin is default PATH for "pip install --user $PKG".
if [[ :$PATH: != *:$HOME/.local/bin:* ]]; then
  export PATH=$PATH:$HOME/.local/bin
fi


if [[ -z $LD_LIBRARY_PATH ]]; then
  LD_LIBRARY_PATH=$HOME/usr/lib
elif [[ :$LD_LIBRARY_PATH: != *:$HOME/usr/lib:* ]]; then
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":$HOME/usr/lib
fi

case $OSTYPE in
  netbsd*) ;;                               # Do nothing, because NetBSD uses non-GNU man.
  *)
    if [[ -z $MANPATH ]]; then
      export MANPATH=$HOME/usr/share/man:
    elif [[ :$MANPATH: != *:$HOME/usr/share/man:* ]]; then
      export MANPATH=$MANPATH:$HOME/usr/share/man:
    fi
    ;;
esac

if [[ -z $INFOPATH ]]; then
  export INFOPATH=$HOME/usr/share/info:
elif [[ :$INFOPATH: != *:$HOME/usr/share/info:* ]]; then
  export INFOPATH=$INFOPATH:$HOME/usr/share/info:
fi

export PYTHONSTARTUP=$HOME/.pystartup

xopt='-Dorg.gradle.daemon=true'
if [[ $GRADLE_OPTS != *${xopt}* ]]; then
    GRADLE_OPTS="$GRADLE_OPTS ${xopt}"
fi
# export GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.console=plain"
# if [[ $OSTYPE = cygwin ]]; then
#     xopt='-Dorg.gradle.console=verbose'
#     if [[ $GRADLE_OPTS != *${xopt}* ]]; then
#         GRADLE_OPTS="$GRADLE_OPTS ${xopt}"
#     fi
# fi
# GRADLE_OPTS="$GRADLE_OPTS -Djava.io.tmpdir=c:/tmp"
export GRADLE_OPTS

if [[ :$PATH: != *:$HOME/.local/npm:* && $OSTYPE != cygwin ]]; then
  export PATH=$PATH:$HOME/.local/npm
fi

export RLWRAP_HOME=$HOME/.rlwrap

unset xopt
