From d469713db1a54b835496e1b12fb7535d3c9dd1e9 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Thu, 3 Apr 2025 16:15:18 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-03 16:15:18 --- .config/helix/scripts/get_git_provider_url.fish | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/helix/scripts/get_git_provider_url.fish b/.config/helix/scripts/get_git_provider_url.fish index 1bb2e000..4d49582a 100755 --- a/.config/helix/scripts/get_git_provider_url.fish +++ b/.config/helix/scripts/get_git_provider_url.fish @@ -19,6 +19,8 @@ function get_git_provider_url --argument filename line_number set provider github else if string match -q '*gitlab.com*' $remote_url set provider gitlab + else if string match -q '*git.sr.ht*' $remote_url + set provider srht else echo "Error: Unsupported git provider." return 1 @@ -26,6 +28,8 @@ function get_git_provider_url --argument filename line_number # Extract the repo path and branch 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) # 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" case gitlab 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