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

consider using gh-generated branch name when developing an issue #37

Open
rorybyrne opened this issue Aug 11, 2024 · 4 comments
Open

consider using gh-generated branch name when developing an issue #37

rorybyrne opened this issue Aug 11, 2024 · 4 comments

Comments

@rorybyrne
Copy link

gh-fzf/gh-fzf

Lines 879 to 892 in 510181c

develop_issue() {
[ -z "$1" ] && error "missing argument." \
"Usage: gh fzf util develop-issue <issue-number>"
branch="$(gh issue develop --list $1 | tail | cut -f1)"
if git show-ref --quiet "refs/heads/$branch"; then
git checkout "$branch"
else
name="$(gh fzf util branch-prompt $1)"
gh issue develop --checkout ${name:+--name "$name"} $1
fi
}

In the else-branch, you query the user for a branch name. However, calling gh issue develop <id> --checkout without supplying a --name <name> will generate a branch name by slugging the issue number/title into something like 05-fix-bug-with-thing.

I would like to run gh fzf i then alt-o on an issue and use this gh-supplied branch name by default.

@benelan
Copy link
Owner

benelan commented Aug 20, 2024

Thanks for the feature request! I think the best solution would be using gh's default branch name if neither GH_FZF_BRANCH_PREFIX nor GH_FZF_BRANCH_ADD_ISSUE_NUMBER config variables are set.

I'd consider that a breaking change though. I plan to release v1 soon with a couple other small breaking changes, so I'll add this to my list as well. I'll provide a temporary workaround in the next week once I have some time to work on gh-fzf again.

@rorybyrne
Copy link
Author

I think the best solution would be using gh's default branch name if neither GH_FZF_BRANCH_PREFIX nor GH_FZF_BRANCH_ADD_ISSUE_NUMBER config variables are set.

Sounds reasonable to me. As long as there's some pathway to using the gh default I'm happy, cos it saves me 30 keystrokes per issue.

If you decide to break the API further, maybe a nullable GH_FZF_BRANCH_NAME_TEMPLATE would be cleaner.

Thanks for building this btw it's great :)

@benelan
Copy link
Owner

benelan commented Aug 21, 2024

Now that #38 is resolved, a temporary solution is pressing enter at the prompt without inputting a branch name. That will use gh's default and is definitely better than re-writing it all yourself. However, I still think there should be a way to bypass the prompt completely.

Glad you're finding gh-fzf useful!

@rorybyrne
Copy link
Author

Oh nice, the empty prompt case is perfect for me. Thanks!

Maybe I'll submit a PR some day once I have more time. Godspeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants