#!/bin/sh

[ "$1" ] || {
    printf '\033[1;33m-> \033[musage: kiss-cargo-urlgen [crate+ver] [crate+ver]\n'
    exit 1
}

# We convert the name-version seperator from '+' to '-' to
# avoid issues that may arise from version numbers that include
# a '-'.

for crate in "$@"; do
    printf 'https://static.crates.io/crates/%s/%s.crate vendor\n' \
        "${crate%+*}" "$(echo "$crate" | sed 's/+/-/')"
done