abinfo "Setting asg as ast-grep symlink ..."
ln -sv ast-grep "$PKGDIR"/usr/bin/asg

abinfo "Generating shell completions ..."
for i in bash fish zsh; do
    "$PKGDIR"/usr/bin/ast-grep completions $i \
        > "$SRCDIR"/ast-grep.$i
    "$PKGDIR"/usr/bin/asg completions $i \
        > "$SRCDIR"/asg.$i
done

abinfo "Installing shell completions ..."
mkdir -pv "$PKGDIR"/usr/share/bash-completion/completions
for i in ast-grep asg; do
    install -Dvm644 "$SRCDIR"/${i}.bash \
        "$PKGDIR"/usr/share/bash-completion/completions/${i}
    install -Dvm644 "$SRCDIR"/${i}.fish \
        "$PKGDIR"/usr/share/fish/vendor_completions.d/${i}.fish
    install -Dvm644 "$SRCDIR"/${i}.zsh \
        "$PKGDIR"/usr/share/zsh/site-functions/_${i}
done
