added completions to yash jump script

This commit is contained in:
Rudis Muiznieks 2025-03-18 20:00:28 -05:00
parent d7eabb19a8
commit 7cfe2b103e
Signed by: rudism
GPG key ID: CABF2F86EF7884F9

View file

@ -5,6 +5,22 @@ _z_exec() {
return $?
}
function completion/z {
OPTIONS=( #>#
"h:; show help text"
"l:; list aliases"
"a:; add a new alias"
"r:; remove alias"
) #<#
command -f completion//parseoptions -n
if [ -z "$ARGOPT" ] || [ "$ARGOPT" = "r" ]; then
complete -T $(_z_exec "select alias from jump_list")
elif [ "$ARGOPT" = "-" ]; then
command -f completion//completeoptions
fi
}
! [ -d ~/.config/z ] && mkdir -p ~/.config/z
! [ -f "$JUMP_LIST" ] && _z_exec 'create table jump_list (alias text primary key, directory text not null)'