As a distro user, I don’t think I would be able to use it until there
is a command to update the installed completion, to call after adding
a new git command to my $PATH. This could mean:
- git-completion.bash.generate learns to read the .in file and
write the completion script to arbitrary paths (or just always
uses stdin and stdout?)
- distros install git-completion.bash.{generate,in} to /usr/share/git-core
- distros install a simple completion script to /etc/bash_completion.d
that passes the buck, e.g.
-- %< --
# bash completion support for core Git.
#
# Run update-git-completion to generate these files.
#
__git_user_completion=~/.cache/git-core/git-completion.bash
__git_system_completion=/var/cache/git-core/git-completion.bash
if test -r "$__git_user_completion"
then
. "$__git_user_completion"
elif test -r "$__git_system_completion"
then
. "$__git_system_completion"
fi
-- >% --
- new update-git-completion script, something like this:
-- %< --
#!/bin/sh
USAGE="update-git-completion {--system | --user | <filename>}"
datadir=/usr/share/git-core
die() {
echo >&2 "$*"
exit 1
}
if ! test $# -eq 1
then
die "usage: $USAGE"
fi
if test "$1" = "--system"
then
output=/var/cache/git-core/git-completion.bash
elif test "$1" = "--user"
then
output=$HOME/.cache/git-core/git-completion.bash
else
output=$1
fi
rm -f "$output+" || die "cannot remove $output+"
sh "$datadir"/git-completion.bash.generate \
< "$datadir"/git-completion.bash.in \
> "$output+" || die "failed to generate completion script"
bash -n "$output+" || {
rm -f "$output+"
die "generated script fails syntax check"
}
mv -f "$output+" "$output" || {
rm -f "$output+"
die "failed to install completion script"
}
-- >% --
Thoughts?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html