From 0e461a382257979037e8927e5f6b468635b0a7fe Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 09:57:23 -0500 Subject: 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 --- Hutch/Extensions/SRHTWebURL.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Hutch/Extensions/SRHTWebURL.swift') 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", -- cgit v1.2.3