function Open-GitHubRepo { param ( [switch]$Issues, [switch]$Branches, [switch]$PullRequests, [switch]$Actions, [switch]$Projects, [switch]$Releases, [switch]$Debug ) # Get the remote URL of the repository $remoteUrl = git remote -v | Select-String -Pattern "\s\(fetch\)" | ForEach-Object { $_.Line.Split()[1] } if ($Debug) { Write-Output "Remote URL: $remoteUrl" } # Extract the author and project name from the remote URL if ($remoteUrl -match 'github.com[:/](.+?)/(.+?)(\.git)?$') { $author = $matches[1] $project = $matches[2] if ($Debug) { Write-Output "Author: $author" Write-Output "Project: $project" } # Base GitHub URL $githubUrl = "https://github.com/$author/$project" # Determine the page to open switch ($true) { $Issues { $githubUrl += "/issues" } $Branches { $githubUrl += "/branches" } $PullRequests { $githubUrl += "/pulls" } $Actions { $githubUrl += "/actions" } $Projects { $githubUrl += "/projects" } $Releases { $githubUrl += "/releases" } } if ($Debug) { Write-Output "GitHub URL: $githubUrl" } # Open the URL in the default web browser Start-Process $githubUrl } else { Write-Output "Failed to parse the GitHub URL." } }