worktree_io/issue/
impls.rs1use super::IssueRef;
2
3impl IssueRef {
4 #[must_use]
6 pub fn workspace_dir_name(&self) -> String {
7 match self {
8 Self::GitHub { number, .. } => format!("issue-{number}"),
9 Self::Linear { id, .. } => format!("linear-{id}"),
10 Self::AzureDevOps { id, .. } => format!("workitem-{id}"),
11 Self::Local { display_number, .. } => format!("issue-{display_number}"),
12 }
13 }
14
15 #[must_use]
17 pub fn branch_name(&self) -> String {
18 self.workspace_dir_name()
19 }
20
21 #[must_use]
27 pub fn clone_url(&self) -> String {
28 match self {
29 Self::GitHub { owner, repo, .. } | Self::Linear { owner, repo, .. } => {
30 format!("https://github.com/{owner}/{repo}.git")
31 }
32 Self::AzureDevOps {
33 org, project, repo, ..
34 } => {
35 format!("https://dev.azure.com/{org}/{project}/_git/{repo}")
36 }
37 Self::Local { .. } => {
38 unreachable!("clone_url is never called for IssueRef::Local")
39 }
40 }
41 }
42}