Created
July 5, 2018 13:32
-
-
Save lqd/4a8af10389d10840d90655c109df5eac to your computer and use it in GitHub Desktop.
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 | |
__printusage() { | |
echo "Usage: $1 <crate> <version> | <crate>-<version>" | |
echo "" | |
echo "e.g. $1 conrod 0.32.0" | |
} | |
if [[ "$#" == 2 ]]; then | |
_crate=$1 | |
_version=$2 | |
elif [[ "$1" =~ .+-([0-9]+(\.)?)+$ ]]; then | |
_crate=${1%-*} | |
_version=${1##*-} | |
else | |
__printusage $0 | |
exit 1 | |
fi | |
curl -L https://crates.io/api/v1/crates/$_crate/$_version/download | tar zxf - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment