mirror of https://github.com/jorgebucaran/fisher
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
469 B
Fish
24 lines
469 B
Fish
function __fisher_url_from_path -a path
|
|
if test -z "$path"
|
|
return 1
|
|
end
|
|
|
|
if test -L "$path"
|
|
readlink $path
|
|
else
|
|
set -l url (git -C "$path" ls-remote --get-url ^ /dev/null)
|
|
|
|
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
|