Skip to content

Commit 12144ab

Browse files
runningcodeclaude
andcommitted
feat: Normalize VCS provider names for cleaner display
Extract meaningful provider names from hostnames by taking the part immediately before the last dot. This provides cleaner names like "github" instead of "github.com" and "azure" instead of "dev.azure.com". Examples: - github.com → github - gitlab.com → gitlab - dev.azure.com → azure - git.mycompany.com → mycompany 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0a89b3d commit 12144ab

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/utils/vcs.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,22 @@ impl VcsUrl {
201201
}
202202

203203
VcsUrl {
204-
provider: host.to_lowercase(),
204+
provider: extract_provider_name(&host.to_lowercase()),
205205
id: strip_git_suffix(path).to_lowercase(),
206206
}
207207
}
208208
}
209209

210+
fn extract_provider_name(host: &str) -> String {
211+
// Take just the part immediately before the last dot
212+
let parts: Vec<&str> = host.split('.').collect();
213+
if parts.len() >= 2 {
214+
parts[parts.len() - 2].to_string()
215+
} else {
216+
host.to_string()
217+
}
218+
}
219+
210220
fn is_matching_url(a: &str, b: &str) -> bool {
211221
VcsUrl::parse(a) == VcsUrl::parse(b)
212222
}

0 commit comments

Comments
 (0)