39 lines
550 B
Bash
39 lines
550 B
Bash
|
|
||
|
|
||
|
# ((git|ssh|http(s)?)?|(git@[\w\.]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)?(/)?
|
||
|
valid_url()
|
||
|
{
|
||
|
# matches https://<domain.tld>/<path>
|
||
|
if [[ "$1" =~ ^https?://.*\..*/.*$ ]]; then
|
||
|
echo '1'
|
||
|
return 0
|
||
|
fi
|
||
|
# matches <user>@<domain.*?>:<path>
|
||
|
if [[ "$1" =~ ^(.*?)(:|/)(.+)(\/.+)*$ ]]; then
|
||
|
echo '2'
|
||
|
return 0
|
||
|
fi
|
||
|
echo '-1'
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
lcat()
|
||
|
{
|
||
|
if [[ -z "$DEBUG_LOG" || "$DEBUG_LOG" == 0 ]]; then
|
||
|
return 0
|
||
|
fi
|
||
|
cat $@ >&2
|
||
|
}
|
||
|
|
||
|
lecho()
|
||
|
{
|
||
|
if [[ -z "$DEBUG_LOG" || "$DEBUG_LOG" == 0 ]]; then
|
||
|
return 0
|
||
|
fi
|
||
|
|
||
|
echo $@ >&2
|
||
|
}
|
||
|
|
||
|
|
||
|
|