Hack together a quick way to execute using local bindirs (#1)
This commit is contained in:
parent
cbc8bede7a
commit
3b01025006
5 changed files with 56 additions and 2 deletions
8
Makefile
8
Makefile
|
@ -1,11 +1,15 @@
|
||||||
excludes = -I Makefile -I README.md
|
excludes = -I Makefile -I README.md
|
||||||
symlinks = $(shell find . \( ! -iname "Makefile" ! -iname "README.md" ! -iname ".*" ! -path "./.git/*" ! -path "./zsh/*" ! -path "./nvim/*" ! -iname "nvim" \) | sed 's|./||')
|
symlinks = $(shell find . -maxdepth 1 \( ! -iname "Makefile" ! -iname "README.md" ! -iname ".*" ! -name "bin" ! -iname "nvim" \) | sed 's|./||')
|
||||||
|
|
||||||
.PHONY: $(symlinks) nvim
|
.PHONY: $(symlinks) nvim
|
||||||
|
|
||||||
all: install
|
all: install
|
||||||
|
|
||||||
install: plug-vim $(symlinks)
|
install: install-bin plug-vim $(symlinks)
|
||||||
|
|
||||||
|
install-bin:
|
||||||
|
mkdir -p $$HOME/bin
|
||||||
|
cp bin/* $$HOME/bin
|
||||||
|
|
||||||
nvim:
|
nvim:
|
||||||
mkdir -p ~/.config/nvim
|
mkdir -p ~/.config/nvim
|
||||||
|
|
25
bin/,
Executable file
25
bin/,
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function find-local-bin {
|
||||||
|
local readonly prefix=$1; shift
|
||||||
|
local bin_dir="$prefix-bin"
|
||||||
|
local found_bin_dir=""
|
||||||
|
|
||||||
|
current_dir=$(pwd)
|
||||||
|
found_bin_dir=$current_dir/$bin_dir
|
||||||
|
while [ ! -d $found_bin_dir ]; do
|
||||||
|
if [[ $current_dir == $HOME ]]; then
|
||||||
|
found_bin_dir=$HOME/bin
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_dir=$(realpath "$current_dir/..")
|
||||||
|
found_bin_dir=$current_dir/$bin_dir
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $found_bin_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
dir=$(find-local-bin aet)
|
||||||
|
|
||||||
|
exec $dir/$@
|
|
@ -7,6 +7,12 @@ function aws-profile {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function aet-bin-exec {
|
||||||
|
local readonly script=$1; shift
|
||||||
|
|
||||||
|
./aet-bin/$script $@
|
||||||
|
}
|
||||||
|
|
||||||
function fix-permissions {
|
function fix-permissions {
|
||||||
find . -type d -print0 | xargs -0 chmod 0755
|
find . -type d -print0 | xargs -0 chmod 0755
|
||||||
find . -type f -print0 | xargs -0 chmod 0644
|
find . -type f -print0 | xargs -0 chmod 0644
|
||||||
|
|
17
zsh-completions/_comma
Normal file
17
zsh-completions/_comma
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#compdef ,
|
||||||
|
local bin_dir="aet-bin"
|
||||||
|
local found_bin_dir=""
|
||||||
|
|
||||||
|
current_dir=$(pwd)
|
||||||
|
found_bin_dir=$current_dir/$bin_dir
|
||||||
|
while [ ! -d $found_bin_dir ]; do
|
||||||
|
if [[ $current_dir == $HOME ]]; then
|
||||||
|
found_bin_dir=$HOME/bin
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_dir=$(realpath "$current_dir/..")
|
||||||
|
found_bin_dir=$current_dir/$bin_dir
|
||||||
|
done
|
||||||
|
|
||||||
|
_files -g "^," -W $found_bin_dir
|
2
zshrc
2
zshrc
|
@ -48,7 +48,9 @@ if which direnv > /dev/null; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# completion
|
# completion
|
||||||
|
fpath=($HOME/.zsh-completions $fpath)
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
|
autoload bashcompinit && bashcompinit
|
||||||
compinit
|
compinit
|
||||||
setopt completeinword
|
setopt completeinword
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue