summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rwxr-xr-xinstall108
1 files changed, 54 insertions, 54 deletions
diff --git a/install b/install
index ec36a5f6..7b10c782 100755
--- a/install
+++ b/install
@@ -46,16 +46,16 @@ for opt in "$@"; do
prefix_expand=${XDG_CONFIG_HOME:-$HOME/.config}/fzf/fzf
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/fzf"
;;
- --key-bindings) key_bindings=1 ;;
- --no-key-bindings) key_bindings=0 ;;
- --completion) auto_completion=1 ;;
- --no-completion) auto_completion=0 ;;
- --update-rc) update_config=1 ;;
- --no-update-rc) update_config=0 ;;
- --bin) ;;
- --no-bash) shells=${shells/bash/} ;;
- --no-zsh) shells=${shells/zsh/} ;;
- --no-fish) shells=${shells/fish/} ;;
+ --key-bindings) key_bindings=1 ;;
+ --no-key-bindings) key_bindings=0 ;;
+ --completion) auto_completion=1 ;;
+ --no-completion) auto_completion=0 ;;
+ --update-rc) update_config=1 ;;
+ --no-update-rc) update_config=0 ;;
+ --bin) ;;
+ --no-bash) shells=${shells/bash/} ;;
+ --no-zsh) shells=${shells/zsh/} ;;
+ --no-fish) shells=${shells/fish/} ;;
*)
echo "unknown option: $opt"
help
@@ -104,7 +104,7 @@ check_binary() {
link_fzf_in_path() {
if which_fzf="$(command -v fzf)"; then
- echo " - Found in \$PATH"
+ echo ' - Found in $PATH'
echo " - Creating symlink: bin/fzf -> $which_fzf"
(cd "$fzf_base"/bin && rm -f fzf && ln -sf "$which_fzf" fzf)
check_binary && return
@@ -114,22 +114,22 @@ link_fzf_in_path() {
try_curl() {
command -v curl > /dev/null &&
- if [[ $1 =~ tar.gz$ ]]; then
- curl -fL $1 | tar --no-same-owner -xzf -
- else
- local temp=${TMPDIR:-/tmp}/fzf.zip
- curl -fLo "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
- fi
+ if [[ $1 =~ tar.gz$ ]]; then
+ curl -fL $1 | tar --no-same-owner -xzf -
+ else
+ local temp=${TMPDIR:-/tmp}/fzf.zip
+ curl -fLo "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
+ fi
}
try_wget() {
command -v wget > /dev/null &&
- if [[ $1 =~ tar.gz$ ]]; then
- wget -O - $1 | tar --no-same-owner -xzf -
- else
- local temp=${TMPDIR:-/tmp}/fzf.zip
- wget -O "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
- fi
+ if [[ $1 =~ tar.gz$ ]]; then
+ wget -O - $1 | tar --no-same-owner -xzf -
+ else
+ local temp=${TMPDIR:-/tmp}/fzf.zip
+ wget -O "$temp" $1 && unzip -o "$temp" && rm -f "$temp"
+ fi
}
download() {
@@ -164,29 +164,29 @@ download() {
}
# Try to download binary executable
-archi=$(uname -smo 2>/dev/null || uname -sm)
+archi=$(uname -smo 2> /dev/null || uname -sm)
binary_available=1
binary_error=""
case "$archi" in
- Darwin\ arm64*) download fzf-$version-darwin_arm64.tar.gz ;;
- Darwin\ x86_64*) download fzf-$version-darwin_amd64.tar.gz ;;
- Linux\ armv5*) download fzf-$version-linux_armv5.tar.gz ;;
- Linux\ armv6*) download fzf-$version-linux_armv6.tar.gz ;;
- Linux\ armv7*) download fzf-$version-linux_armv7.tar.gz ;;
- Linux\ armv8*) download fzf-$version-linux_arm64.tar.gz ;;
+ Darwin\ arm64*) download fzf-$version-darwin_arm64.tar.gz ;;
+ Darwin\ x86_64*) download fzf-$version-darwin_amd64.tar.gz ;;
+ Linux\ armv5*) download fzf-$version-linux_armv5.tar.gz ;;
+ Linux\ armv6*) download fzf-$version-linux_armv6.tar.gz ;;
+ Linux\ armv7*) download fzf-$version-linux_armv7.tar.gz ;;
+ Linux\ armv8*) download fzf-$version-linux_arm64.tar.gz ;;
Linux\ aarch64\ Android) download fzf-$version-android_arm64.tar.gz ;;
- Linux\ aarch64*) download fzf-$version-linux_arm64.tar.gz ;;
- Linux\ loongarch64*) download fzf-$version-linux_loong64.tar.gz ;;
- Linux\ ppc64le*) download fzf-$version-linux_ppc64le.tar.gz ;;
- Linux\ *64*) download fzf-$version-linux_amd64.tar.gz ;;
- Linux\ s390x*) download fzf-$version-linux_s390x.tar.gz ;;
- FreeBSD\ *64*) download fzf-$version-freebsd_amd64.tar.gz ;;
- OpenBSD\ *64*) download fzf-$version-openbsd_amd64.tar.gz ;;
- CYGWIN*\ *64*) download fzf-$version-windows_amd64.zip ;;
- MINGW*\ *64*) download fzf-$version-windows_amd64.zip ;;
- MSYS*\ *64*) download fzf-$version-windows_amd64.zip ;;
- Windows*\ *64*) download fzf-$version-windows_amd64.zip ;;
- *) binary_available=0 binary_error=1 ;;
+ Linux\ aarch64*) download fzf-$version-linux_arm64.tar.gz ;;
+ Linux\ loongarch64*) download fzf-$version-linux_loong64.tar.gz ;;
+ Linux\ ppc64le*) download fzf-$version-linux_ppc64le.tar.gz ;;
+ Linux\ *64*) download fzf-$version-linux_amd64.tar.gz ;;
+ Linux\ s390x*) download fzf-$version-linux_s390x.tar.gz ;;
+ FreeBSD\ *64*) download fzf-$version-freebsd_amd64.tar.gz ;;
+ OpenBSD\ *64*) download fzf-$version-openbsd_amd64.tar.gz ;;
+ CYGWIN*\ *64*) download fzf-$version-windows_amd64.zip ;;
+ MINGW*\ *64*) download fzf-$version-windows_amd64.zip ;;
+ MSYS*\ *64*) download fzf-$version-windows_amd64.zip ;;
+ Windows*\ *64*) download fzf-$version-windows_amd64.zip ;;
+ *) binary_available=0 binary_error=1 ;;
esac
cd "$fzf_base"
@@ -215,7 +215,7 @@ if [ -n "$binary_error" ]; then
fi
fi
-[[ "$*" =~ "--bin" ]] && exit 0
+[[ $* =~ "--bin" ]] && exit 0
for s in $shells; do
if ! command -v "$s" > /dev/null; then
@@ -242,7 +242,7 @@ fi
echo
for shell in $shells; do
- [[ "$shell" = fish ]] && continue
+ [[ $shell == fish ]] && continue
src=${prefix_expand}.${shell}
echo -n "Generate $src ... "
@@ -266,7 +266,7 @@ fi
EOF
if [[ $auto_completion -eq 1 ]] && [[ $key_bindings -eq 1 ]]; then
- if [[ "$shell" = zsh ]]; then
+ if [[ $shell == zsh ]]; then
echo "source <(fzf --$shell)" >> "$src"
else
echo "eval \"\$(fzf --$shell)\"" >> "$src"
@@ -286,7 +286,7 @@ EOF
done
# fish
-if [[ "$shells" =~ fish ]]; then
+if [[ $shells =~ fish ]]; then
echo -n "Update fish_user_paths ... "
fish << EOF
echo \$fish_user_paths | \grep "$fzf_base"/bin > /dev/null
@@ -318,9 +318,9 @@ append_line() {
sed 's/^/ Line /' <<< "$lines"
update=0
- if ! \grep -qv "^[0-9]*:[[:space:]]*#" <<< "$lines" ; then
+ if ! \grep -qv "^[0-9]*:[[:space:]]*#" <<< "$lines"; then
echo " - But they all seem to be commented"
- ask " - Continue modifying $file?"
+ ask " - Continue modifying $file?"
update=$?
fi
fi
@@ -356,12 +356,12 @@ if [ $update_config -eq 2 ]; then
fi
echo
for shell in $shells; do
- [[ "$shell" = fish ]] && continue
+ [[ $shell == fish ]] && continue
[ $shell = zsh ] && dest=${ZDOTDIR:-~}/.zshrc || dest=~/.bashrc
append_line $update_config "[ -f ${prefix}.${shell} ] && source ${prefix}.${shell}" "$dest" "${prefix}.${shell}"
done
-if [ $key_bindings -eq 1 ] && [[ "$shells" =~ fish ]]; then
+if [ $key_bindings -eq 1 ] && [[ $shells =~ fish ]]; then
bind_file="${fish_dir}/functions/fish_user_key_bindings.fish"
if [ ! -e "$bind_file" ]; then
mkdir -p "${fish_dir}/functions"
@@ -386,13 +386,13 @@ fi
if [ $update_config -eq 1 ]; then
echo 'Finished. Restart your shell or reload config file.'
- if [[ "$shells" =~ bash ]]; then
+ if [[ $shells =~ bash ]]; then
echo -n ' source ~/.bashrc # bash'
- [[ "$archi" =~ Darwin ]] && echo -n ' (.bashrc should be loaded from .bash_profile)'
+ [[ $archi =~ Darwin ]] && echo -n ' (.bashrc should be loaded from .bash_profile)'
echo
fi
- [[ "$shells" =~ zsh ]] && echo " source ${ZDOTDIR:-~}/.zshrc # zsh"
- [[ "$shells" =~ fish ]] && [ $key_bindings -eq 1 ] && echo ' fzf_key_bindings # fish'
+ [[ $shells =~ zsh ]] && echo " source ${ZDOTDIR:-~}/.zshrc # zsh"
+ [[ $shells =~ fish ]] && [ $key_bindings -eq 1 ] && echo ' fzf_key_bindings # fish'
echo
echo 'Use uninstall script to remove fzf.'
echo