mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge 79d8763944
into de98e83b25
This commit is contained in:
commit
374ed5e630
@ -33,7 +33,7 @@ if [[ -n ${AUTOJUMP_AUTOCOMPLETE_CMDS} ]]; then
|
||||
fi
|
||||
|
||||
#determine the data directory according to the XDG Base Directory Specification
|
||||
if [[ -n ${XDG_DATA_HOME} ]] && [[ ${XDG_DATA_HOME} =~ ${USER} ]]; then
|
||||
if [[ -n ${XDG_DATA_HOME} ]] && [[ ${XDG_DATA_HOME} = ${USER} ]]; then
|
||||
export AUTOJUMP_DATA_DIR="${XDG_DATA_HOME}/autojump"
|
||||
else
|
||||
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
|
||||
@ -73,7 +73,7 @@ case $PROMPT_COMMAND in
|
||||
esac
|
||||
|
||||
function j {
|
||||
if [[ ${@} =~ ^-{1,2}.* ]]; then
|
||||
if [[ ${@} = -* ]]; then
|
||||
autojump ${@}
|
||||
return
|
||||
fi
|
||||
|
44
install.sh
44
install.sh
@ -11,6 +11,9 @@ function help_msg {
|
||||
echo " -p, --prefix PATH Use PATH as prefix"
|
||||
echo " -Z, --zshshare PATH Use PATH as zsh share destination"
|
||||
echo
|
||||
echo " -b, --bash Assume shell is bash"
|
||||
echo " -z, --zsh Assume shell is zsh"
|
||||
echo
|
||||
echo " -f, --force Ignore Python version check"
|
||||
echo " -n, --dry_run Only show installation paths, don't install anything"
|
||||
echo
|
||||
@ -46,6 +49,13 @@ if [[ ${#} == 1 ]] && ([[ $1 = "-n" ]] || [[ $1 = "--dry-run" ]]); then
|
||||
set -- "-n" "--auto"
|
||||
fi
|
||||
|
||||
# `install` isn't supported on Windows
|
||||
if which install; then
|
||||
install="install -v -m 0755"
|
||||
else
|
||||
install="cp -r"
|
||||
fi
|
||||
|
||||
# Command line parsing
|
||||
while true; do
|
||||
case "$1" in
|
||||
@ -56,6 +66,10 @@ while true; do
|
||||
set -- "--local" "${@:2}"
|
||||
fi
|
||||
;;
|
||||
-b|--bash)
|
||||
shell="bash"
|
||||
shift
|
||||
;;
|
||||
-d|--destdir)
|
||||
if [ $# -gt 1 ]; then
|
||||
destdir=$2; shift 2
|
||||
@ -98,6 +112,10 @@ while true; do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-z|--zsh)
|
||||
shell="zsh"
|
||||
shift
|
||||
;;
|
||||
-Z|--zshshare)
|
||||
if [ $# -gt 1 ]; then
|
||||
zshsharedir=$2; shift 2
|
||||
@ -205,20 +223,20 @@ if [[ $dry_run ]]; then
|
||||
fi
|
||||
|
||||
# INSTALL AUTOJUMP
|
||||
mkdir -p ${destdir}${prefix}share/autojump/ || exit 1
|
||||
mkdir -p ${destdir}${prefix}bin/ || exit 1
|
||||
mkdir -p ${destdir}${prefix}share/man/man1/ || exit 1
|
||||
cp -v ./bin/icon.png ${destdir}${prefix}share/autojump/ || exit 1
|
||||
cp -v ./bin/autojump ${destdir}${prefix}bin/ || exit 1
|
||||
cp -v ./bin/autojump_argparse.py ${destdir}${prefix}bin/ || exit 1
|
||||
cp -v ./docs/autojump.1 ${destdir}${prefix}share/man/man1/ || exit 1
|
||||
mkdir -p ${destdir}etc/profile.d/ || exit 1
|
||||
cp -v ./bin/autojump.sh ${destdir}etc/profile.d/ || exit 1
|
||||
cp -v ./bin/autojump.bash ${destdir}etc/profile.d/ || exit 1
|
||||
cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/ || exit 1
|
||||
mkdir -p ${destdir}${zshsharedir} || exit 1
|
||||
mkdir -p "${destdir}${prefix}share/autojump/" || exit 1
|
||||
mkdir -p "${destdir}${prefix}bin/" || exit 1
|
||||
mkdir -p "${destdir}${prefix}share/man/man1/" || exit 1
|
||||
cp -v ./bin/icon.png "${destdir}${prefix}share/autojump/" || exit 1
|
||||
cp -v ./bin/autojump "${destdir}${prefix}bin/" || exit 1
|
||||
cp -v ./bin/autojump_argparse.py "${destdir}${prefix}bin/" || exit 1
|
||||
cp -v ./docs/autojump.1 "${destdir}${prefix}share/man/man1/" || exit 1
|
||||
mkdir -p "${destdir}etc/profile.d/" || exit 1
|
||||
cp -v ./bin/autojump.sh "${destdir}etc/profile.d/" || exit 1
|
||||
cp -v ./bin/autojump.bash "${destdir}etc/profile.d/" || exit 1
|
||||
cp -v ./bin/autojump.zsh "${destdir}etc/profile.d/" || exit 1
|
||||
mkdir -p "${destdir}${zshsharedir}" || exit 1
|
||||
# TODO: remove unused _j function (2013.02.01_1348, ting)
|
||||
install -v -m 0755 ./bin/_j ${destdir}${zshsharedir} || exit 1
|
||||
${install} ./bin/_j "${destdir}${zshsharedir}" || exit 1
|
||||
|
||||
# MODIFY AUTOJUMP.SH FOR CUSTOM INSTALLS
|
||||
if [[ -z ${local} ]] && [[ -z ${global} ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user