@@ -14,7 +14,7 @@ import (
1414
1515func New (restClient ghapi.RESTClient ) * cobra.Command {
1616 cmd := & cobra.Command {
17- Use : "pr" ,
17+ Use : "pr [pr number] <path> " ,
1818 Short : "worktree from PR" ,
1919 Long : "Create a new worktree from a PR number" ,
2020 Args : func (cmd * cobra.Command , args []string ) error {
@@ -34,8 +34,12 @@ func New(restClient ghapi.RESTClient) *cobra.Command {
3434 return err
3535 }
3636
37- fmt .Printf ("hell yeah brother %+v\n " , branchName )
38- return createWorktree (branchName )
37+ path := branchName
38+ if len (args ) > 1 {
39+ path = args [1 ]
40+ }
41+
42+ return createWorktree (branchName , path )
3943 },
4044 }
4145
@@ -57,8 +61,8 @@ func getPullRequest(rc ghapi.RESTClient, owner, repo, pr string) (string, error)
5761 return response .Head .Ref , nil
5862}
5963
60- func createWorktree (branchName string ) error {
61- cmdList := []string {"git" , "worktree" , "add" , branchName }
64+ func createWorktree (branchName string , path string ) error {
65+ cmdList := []string {"git" , "worktree" , "add" , path , branchName }
6266
6367 exe , err := safeexec .LookPath (cmdList [0 ])
6468 if err != nil {
0 commit comments