Created
June 10, 2019 18:48
-
-
Save niedbalski/1664d8f16e1bc0cd19b91a9d0d8d65df to your computer and use it in GitHub Desktop.
charmhead.sh
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
function charmhead() { | |
if [ ! ${#@} -ge 2 ]; then | |
echo "usage ./$0 charm revision" && return; | |
fi | |
q=$(curl -s https://api.jujucharms.com/charmstore/v5/$1-$2/archive/repo-info | python -c "import sys, re; q=map(lambda x: re.search('.*commit-short\: (.*)', x), sys.stdin.readlines()); print(q[1].group(1))") | |
if [ -n "$q" ]; then | |
echo "$q"; | |
else | |
echo "Not found revision for charm: $1" | |
fi | |
} | |
export -f charmhead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment