summaryrefslogtreecommitdiff
path: root/Hutch/Extensions/SRHTWebURL.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
committerChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
commit0e461a382257979037e8927e5f6b468635b0a7fe (patch)
tree0aa3a19f6f8f966b0e90f4874ed54359a7898107 /Hutch/Extensions/SRHTWebURL.swift
parentee9f2904aa319231b7047fca3cb069f0c07019cd (diff)
downloadhutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.gz
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.bz2
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.zip
feat: add power user actions
Implements: https://todo.sr.ht/~ccleberg/hutch/52 Implements: https://todo.sr.ht/~ccleberg/hutch/53 Implements: https://todo.sr.ht/~ccleberg/hutch/54
Diffstat (limited to 'Hutch/Extensions/SRHTWebURL.swift')
-rw-r--r--Hutch/Extensions/SRHTWebURL.swift14
1 files changed, 14 insertions, 0 deletions
diff --git a/Hutch/Extensions/SRHTWebURL.swift b/Hutch/Extensions/SRHTWebURL.swift
index cd8e8be..bfed48b 100644
--- a/Hutch/Extensions/SRHTWebURL.swift
+++ b/Hutch/Extensions/SRHTWebURL.swift
@@ -12,6 +12,16 @@ enum SRHTWebURL {
)
}
+ static func httpsCloneURL(_ repositorySummary: RepositorySummary) -> String? {
+ repository(repositorySummary)?.absoluteString
+ }
+
+ static func sshCloneURL(_ repositorySummary: RepositorySummary) -> String {
+ let host = "\(repositorySummary.service.rawValue).sr.ht"
+ let user = repositorySummary.service == .hg ? "hg" : "git"
+ return "\(user)@\(host):\(repositorySummary.owner.canonicalName)/\(repositorySummary.name)"
+ }
+
static func commit(repository: RepositorySummary, commitId: String) -> URL? {
userScopedURL(
host: "\(repository.service.rawValue).sr.ht",
@@ -63,6 +73,10 @@ enum SRHTWebURL {
)
}
+ static func tracker(_ trackerSummary: TrackerSummary) -> URL? {
+ tracker(ownerUsername: trackerSummary.owner.canonicalName.srhtUsername, trackerName: trackerSummary.name)
+ }
+
static func projectSource(_ source: Project.SourceRepo) -> URL? {
userScopedURL(
host: "\(source.repoType.service.rawValue).sr.ht",