repotool/lib/stdlib.sh

48 lines
657 B
Bash
Raw Normal View History

2024-05-01 23:12:04 +00:00
# ((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
}
2024-05-02 00:43:43 +00:00
linspect()
{
if [[ -z "$DEBUG_LOG" || "$DEBUG_LOG" == 0 ]]; then
return 0
fi
inspect_args>&2
}
2024-05-01 23:12:04 +00:00