AutoYADM commit: 2025-04-03 16:15:18
This commit is contained in:
parent
b7c298cf25
commit
d469713db1
1 changed files with 6 additions and 0 deletions
|
@ -19,6 +19,8 @@ function get_git_provider_url --argument filename line_number
|
||||||
set provider github
|
set provider github
|
||||||
else if string match -q '*gitlab.com*' $remote_url
|
else if string match -q '*gitlab.com*' $remote_url
|
||||||
set provider gitlab
|
set provider gitlab
|
||||||
|
else if string match -q '*git.sr.ht*' $remote_url
|
||||||
|
set provider srht
|
||||||
else
|
else
|
||||||
echo "Error: Unsupported git provider."
|
echo "Error: Unsupported git provider."
|
||||||
return 1
|
return 1
|
||||||
|
@ -26,6 +28,8 @@ function get_git_provider_url --argument filename line_number
|
||||||
|
|
||||||
# Extract the repo path and branch
|
# Extract the repo path and branch
|
||||||
set repo_path (echo $remote_url | perl -nE 'say $2 if /\.com(:|\/)(.*)\.git/')
|
set repo_path (echo $remote_url | perl -nE 'say $2 if /\.com(:|\/)(.*)\.git/')
|
||||||
|
echo $repo_path
|
||||||
|
return
|
||||||
set branch (git rev-parse --abbrev-ref HEAD)
|
set branch (git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
# Generate the URL based on the provider
|
# Generate the URL based on the provider
|
||||||
|
@ -34,6 +38,8 @@ function get_git_provider_url --argument filename line_number
|
||||||
echo "https://github.com/$repo_path/blob/$branch/$filename#L$line_number"
|
echo "https://github.com/$repo_path/blob/$branch/$filename#L$line_number"
|
||||||
case gitlab
|
case gitlab
|
||||||
echo "https://gitlab.com/$repo_path/-/blob/$branch/$filename#L$line_number"
|
echo "https://gitlab.com/$repo_path/-/blob/$branch/$filename#L$line_number"
|
||||||
|
case srht
|
||||||
|
echo "https://git.sr.ht/$repo_path/-/blob/$branch/$filename#L$line_number"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue