mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-18 01:29:06 +00:00
feat: more autocompletions
This commit is contained in:
15
completions/_prj
Executable file
15
completions/_prj
Executable file
@@ -0,0 +1,15 @@
|
||||
#compdef prj
|
||||
prjpath="$(wd path dv)"
|
||||
names=($(ls $prjpath))
|
||||
|
||||
if [[ -z $names ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
out=()
|
||||
|
||||
for i in $names; do
|
||||
out+=("$i:$prjpath/$i")
|
||||
done
|
||||
|
||||
_describe 'project' out
|
||||
22
completions/_src
Executable file
22
completions/_src
Executable file
@@ -0,0 +1,22 @@
|
||||
#compdef src rc
|
||||
dfpath="$(wd path df)"
|
||||
|
||||
out=()
|
||||
|
||||
__read_dir() {
|
||||
dir="$1"
|
||||
res=($(find $1 -print | sed "s/${1//\//\\/}\///"))
|
||||
|
||||
for i in $res; do
|
||||
# echo "checking path: $1/$i"
|
||||
if [[ -f "$1/$i" ]] && [[ ! $i =~ \b\.git\b ]]; then
|
||||
out+=("$i")
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cd "$dfpath"
|
||||
__read_dir .
|
||||
|
||||
_describe 'dotfile' out
|
||||
# echo $out
|
||||
@@ -53,7 +53,6 @@ ucase() {
|
||||
echo "$@" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
|
||||
int_res() {
|
||||
# get all but last
|
||||
c=$(($# - 1))
|
||||
@@ -262,3 +261,5 @@ docker-volume-cd() {
|
||||
|
||||
autoload _docker-exec
|
||||
autoload _docker-volume-path
|
||||
autoload _prj
|
||||
autoload _src
|
||||
|
||||
Reference in New Issue
Block a user