mirror of
https://github.com/jorgebucaran/fisher
synced 2024-11-09 07:10:27 +00:00
28 lines
493 B
Fish
28 lines
493 B
Fish
function __fisher_url_from_path -a path
|
|
if test -z "$path"
|
|
return 1
|
|
end
|
|
|
|
if test -L "$path"
|
|
readlink $path
|
|
else
|
|
pushd $path
|
|
|
|
set -l url (git ls-remote --get-url ^ /dev/null)
|
|
|
|
popd
|
|
|
|
if test -z "$url"
|
|
return 1
|
|
end
|
|
|
|
switch "$url"
|
|
case \*gist.github.com\*
|
|
printf "%s@%s\n" (basename $path) $url
|
|
|
|
case \*
|
|
printf "%s\n" "$url"
|
|
end
|
|
end
|
|
end
|