MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / parse_github_remote

Function parse_github_remote

crates/opencode-cli/src/main.rs:4011–4032  ·  view source on GitHub ↗
(url: &str)

Source from the content-addressed store, hash-verified

4009}
4010
4011fn parse_github_remote(url: &str) -> Option<(String, String)> {
4012 let normalized = url.trim().trim_end_matches('/').trim_end_matches(".git");
4013 let path = if let Some(value) = normalized.strip_prefix("https://github.com/") {
4014 value
4015 } else if let Some(value) = normalized.strip_prefix("http://github.com/") {
4016 value
4017 } else if let Some(value) = normalized.strip_prefix("ssh://git@github.com/") {
4018 value
4019 } else if let Some(value) = normalized.strip_prefix("git@github.com:") {
4020 value
4021 } else {
4022 return None;
4023 };
4024
4025 let mut parts = path.split('/');
4026 let owner = parts.next()?.trim();
4027 let repo = parts.next()?.trim();
4028 if owner.is_empty() || repo.is_empty() {
4029 return None;
4030 }
4031 Some((owner.to_string(), repo.to_string()))
4032}
4033
4034fn provider_secret_keys(provider: &str) -> Vec<&'static str> {
4035 match provider {

Callers 2

handle_github_commandFunction · 0.85

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected