48 lines
657 B
Bash
Executable File
48 lines
657 B
Bash
Executable File
|
|
|
|
# ((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
|
|
}
|
|
|
|
linspect()
|
|
{
|
|
if [[ -z "$DEBUG_LOG" || "$DEBUG_LOG" == 0 ]]; then
|
|
return 0
|
|
fi
|
|
|
|
inspect_args>&2
|
|
}
|
|
|
|
|
|
|