feat: more autocompletions

This commit is contained in:
Chen Asraf
2023-02-14 08:57:55 +02:00
parent e0a1ed7f2e
commit 916d2621d5
3 changed files with 39 additions and 1 deletions

15
completions/_prj Executable file
View 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
View 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

View File

@@ -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