1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Remove --bash and --zsh options, always install both versions.

A few KB of disk space is not worth the logic overhead.
This commit is contained in:
William Ting 2012-11-22 12:01:21 -06:00
parent 987ead6814
commit b512aec9bf

View File

@ -3,7 +3,7 @@
function help_msg { function help_msg {
echo "./install.sh [OPTION..]" echo "./install.sh [OPTION..]"
echo echo
echo " -a, --auto Try to determine destdir, prefix, shell (and zshshare if apply)" echo " -a, --auto Try to determine destdir, prefix (and zshshare if applicable)"
echo " -g, --global Use default global settings (destdir=/; prefix=usr)" echo " -g, --global Use default global settings (destdir=/; prefix=usr)"
echo " -l, --local Use default local settings (destdir=~/.autojump)" echo " -l, --local Use default local settings (destdir=~/.autojump)"
echo echo
@ -11,14 +11,11 @@ function help_msg {
echo " -p, --prefix PATH Use PATH as prefix" echo " -p, --prefix PATH Use PATH as prefix"
echo " -Z, --zshshare PATH Use PATH as zsh share destination" echo " -Z, --zshshare PATH Use PATH as zsh share destination"
echo echo
echo " -b, --bash Install for bash only"
echo " -z, --zsh Install for zsh only"
echo " (If neither are specified, both bash & zsh support are installed)"
echo
echo " -f, --force Ignore python version check" echo " -f, --force Ignore python version check"
echo " -n, --dry_run Only show installation paths, don't install anything" echo " -n, --dry_run Only show installation paths, don't install anything"
echo echo
echo "Will install autojump into:" echo "Will install autojump into:"
echo
echo ' Binaries: $destdir$prefix/bin' echo ' Binaries: $destdir$prefix/bin'
echo ' Documentation: $destdir$prefix/share/man/man1' echo ' Documentation: $destdir$prefix/share/man/man1'
echo ' Icon: $destdir$prefix/share/autojump' echo ' Icon: $destdir$prefix/share/autojump'
@ -35,7 +32,7 @@ dry_run=
auto= auto=
local= local=
force= force=
shell= shell=`echo ${SHELL} | awk -F/ '{ print $NF }'`
destdir= destdir=
prefix="usr/local" prefix="usr/local"
zshsharedir= zshsharedir=
@ -56,10 +53,6 @@ while true; do
set -- "--local" "${@:2}" set -- "--local" "${@:2}"
fi fi
;; ;;
-b|--bash)
shell="bash"
shift
;;
-d|--destdir) -d|--destdir)
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
destdir=$2; shift 2 destdir=$2; shift 2
@ -98,10 +91,6 @@ while true; do
exit 1 exit 1
fi fi
;; ;;
-z|--zsh)
shell="zsh"
shift
;;
-Z|--zshshare) -Z|--zshshare)
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
zshsharedir=$2; shift 2 zshsharedir=$2; shift 2
@ -150,14 +139,14 @@ if [[ -n ${prefix} ]]; then
fi fi
fi fi
# check shell if supported # check shell support
if [[ -n ${shell} ]] && [[ ${shell} != "bash" ]] && [[ ${shell} != "zsh" ]]; then if [[ ${shell} != "bash" ]] && [[ ${shell} != "zsh" ]]; then
echo "Unsupported shell (${shell}). Use --bash or --zsh to explicitly define shell." echo "Unsupported shell (${shell}). Only bash and zsh shells are supported."
exit 1 exit 1
fi fi
# zsh functions # zsh functions
if [[ -z $shell ]] || [[ $shell == "zsh" ]]; then if [[ $shell == "zsh" ]]; then
if [[ -z $zshsharedir ]]; then if [[ -z $zshsharedir ]]; then
# if not set, use a default # if not set, use a default
if [[ $local ]]; then if [[ $local ]]; then
@ -193,11 +182,6 @@ echo "Destination: $destdir"
if [[ -n $prefix ]]; then if [[ -n $prefix ]]; then
echo "Prefix: /$prefix" echo "Prefix: /$prefix"
fi fi
if [[ -n $shell ]]; then
echo "Shell: $shell"
else
echo "Shell: bash & zsh"
fi
echo echo
echo "Binary: ${destdir}${prefix}bin/" echo "Binary: ${destdir}${prefix}bin/"
echo "Documentation: ${destdir}${prefix}share/man/man1/" echo "Documentation: ${destdir}${prefix}share/man/man1/"
@ -224,14 +208,10 @@ cp -v ./bin/autojump_argparse.py ${destdir}${prefix}bin/
cp -v ./docs/autojump.1 ${destdir}${prefix}share/man/man1/ cp -v ./docs/autojump.1 ${destdir}${prefix}share/man/man1/
mkdir -p ${destdir}etc/profile.d/ mkdir -p ${destdir}etc/profile.d/
cp -v ./bin/autojump.sh ${destdir}etc/profile.d/ cp -v ./bin/autojump.sh ${destdir}etc/profile.d/
if [[ -z $shell ]] || [[ $shell == "bash" ]]; then
cp -v ./bin/autojump.bash ${destdir}etc/profile.d/ cp -v ./bin/autojump.bash ${destdir}etc/profile.d/
fi
if [[ -z $shell ]] || [[ $shell == "zsh" ]]; then
cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/ cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/
mkdir -p ${destdir}${zshsharedir} mkdir -p ${destdir}${zshsharedir}
install -v -m 0755 ./bin/_j ${destdir}${zshsharedir} install -v -m 0755 ./bin/_j ${destdir}${zshsharedir}
fi
echo "Remember: you need to source ${destdir}etc/profile.d/autojump.sh before you can use autojump" echo "Remember: you need to source ${destdir}etc/profile.d/autojump.sh before you can use autojump"