Created
October 12, 2015 23:52
-
-
Save hwine/9e4edfa939664c6c8fee to your computer and use it in GitHub Desktop.
Install matching bash completion script for current hg version.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
hg_version=$(hg --version | grep version | sed 's,^.*(version ,,; s,).*,,') | |
hg_base_url=https://selenic.com/hg/rawfile/${hg_version}/contrib/bash_completion | |
tmp_file=/tmp/hg_completion.bash | |
cur_file=/usr/local/etc/bash_completion.d/hg | |
# Get requested version | |
curl -o ${tmp_file} ${hg_base_url} | |
# see if it is a change | |
if cmp --quiet ${tmp_file} ${cur_file}; then | |
echo "Already set for ${hg_version}" | |
else | |
mv ${tmp_file} ${cur_file} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment