Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to use keybindings on pull request without having the repo pulled down? #353

Open
venkatamutyala opened this issue Apr 4, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@venkatamutyala
Copy link

Describe the bug
Using custom keybindings to preform actions extermally

To Reproduce
Steps to reproduce the behavior:

  1. I add a custom key binding that like so:
    keybindings:
    issues: []
    prs:
    • key: e
      command: >
      echo "Hello" > test.txt

and when the binding it says "Failed to find the local path for the repo ...

Expected behavior
I expected it to just echo "Hello" to disk. I didn't expect to have the actual repo cloned down in order to be able to run external commands.

Screenshots
N/A

Desktop (please complete the following information):

  • docker/linux/ubuntu
@venkatamutyala venkatamutyala added the bug Something isn't working label Apr 4, 2024
@venkatamutyala venkatamutyala changed the title [BUG] [BUG] Unable to use keybindings on pull request without having the repo pulled down? Apr 4, 2024
@dlvhdr
Copy link
Owner

dlvhdr commented Apr 6, 2024

Seems simple to solve, care to contribute it?
Also, what's your use case?

@venkatamutyala
Copy link
Author

venkatamutyala commented Apr 6, 2024

@dlvhdr I'd be happy to try. I'm relatively new to golang so I'll probably need a few pointers.

My use case is I'd like to be able to use gh-dash to manage all open pull requests, irrespective of having a repo cloned down. As for the command I would like to run, I want to have a keyboard shortcut that let's me approve a PR.

@Omnikron13
Copy link
Contributor

Omnikron13 commented Apr 17, 2024

gh-dash/ui/modelUtils.go

Lines 112 to 118 in 94c6603

repoPath, ok := common.GetRepoLocalPath(repoName, m.ctx.Config.RepoPaths)
if !ok {
return func() tea.Msg {
return constants.ErrMsg{Err: fmt.Errorf("Failed to find local path for repo %s", repoName)}
}
}

@venkatamutyala Over-zealous error check here, I believe. Exits out early without actually knowing or caring if the template being Executed needs the local path.

Omnikron13 added a commit to Omnikron13/gh-dash that referenced this issue Apr 17, 2024
Removes an assumption that specific data/keys are required by the bound
command.

Instead `Template.Option()` is used to tell the Template to error out if
and when it actually encounters a key it needs.
Omnikron13 added a commit to Omnikron13/gh-dash that referenced this issue Apr 18, 2024
Unfortuneatly it seems the Template options are a little lacking, and
I don't believe can be persuaded to accept zero values or even nil
pointers as 'missing' values.

The struct in question, `PRCommandTemplateInput`, appears to have no use
elsewhere however, so was easily replaced with a map, which I hope
serves your needs for the near future at least.
dlvhdr pushed a commit that referenced this issue May 24, 2024
Removes an assumption that specific data/keys are required by the bound
command.

Instead `Template.Option()` is used to tell the Template to error out if
and when it actually encounters a key it needs.
dlvhdr pushed a commit that referenced this issue May 24, 2024
Unfortuneatly it seems the Template options are a little lacking, and
I don't believe can be persuaded to accept zero values or even nil
pointers as 'missing' values.

The struct in question, `PRCommandTemplateInput`, appears to have no use
elsewhere however, so was easily replaced with a map, which I hope
serves your needs for the near future at least.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants