mirror of
https://github.com/Pull-Pal/pull-pal.git
synced 2026-06-13 23:19:09 -04:00
Add ability to copy LLM prompt directly to clipboard
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/mobyvb/pull-pal/llm"
|
||||
"github.com/mobyvb/pull-pal/vc"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -58,6 +59,22 @@ func (p *PullPal) PickIssueToFile(promptPath string) (issue vc.Issue, changeRequ
|
||||
return issue, changeRequest, err
|
||||
}
|
||||
|
||||
// PickIssueToClipboard is the same as PickIssue, but the changeRequest is converted to a string and copied to the clipboard.
|
||||
func (p *PullPal) PickIssueToClipboard(promptPath string) (issue vc.Issue, changeRequest llm.CodeChangeRequest, err error) {
|
||||
issue, changeRequest, err = p.PickIssue()
|
||||
if err != nil {
|
||||
return issue, changeRequest, err
|
||||
}
|
||||
|
||||
prompt, err := changeRequest.GetPrompt()
|
||||
if err != nil {
|
||||
return issue, changeRequest, err
|
||||
}
|
||||
|
||||
err = clipboard.WriteAll(prompt)
|
||||
return issue, changeRequest, err
|
||||
}
|
||||
|
||||
// PickIssue selects an issue from the version control server and returns the selected issue, as well as the LLM prompt needed to fulfill the request.
|
||||
func (p *PullPal) PickIssue() (issue vc.Issue, changeRequest llm.CodeChangeRequest, err error) {
|
||||
// TODO I should be able to pass in settings for listing issues from here
|
||||
|
||||
Reference in New Issue
Block a user