#!/bin/bash

set -eu

cat <<- EOF
	autoload              /usr/lib/vim-command-t/
	plugin                /usr/lib/vim-command-t/
	doc/*.txt             /usr/lib/vim-command-t/doc/
	ruby/command-t/ext.so /usr/lib/vim-command-t/ruby/command-t/
EOF

# Our goal is to install all the ruby files that we can find within the ruby
# directory, to the same relative path underneath /usr/lib/vim-command-t.
mapfile -t rb < <(find ruby -name '*.rb')
for f in "${rb[@]}"; do
	IFS=/ read -a components <<< "$f"
	n=$((${#components[@]} - 1))
	(IFS=/; echo "$f" "/usr/lib/vim-command-t/${components[*]:0:$n}")
done
