You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Skip issue creation prompt completely & open the editor instead #390
Describe the feature or problem you’d like to solve
I prefer hub behavior of creating PRs, which open the editor directly to fill in everything (title & body). I'd like to have a way to skip all the prompts if possible with gh. I'm aware that the prompt is mainly needed to be able to preview the PR later before submission but that's something I rarely need or use, it also reduces friction & allows you to edit your PR title easier if you change your mind or had a typo.
Proposed solution
Add a --skip-prompt or maybe --editor flag to skip the prompt
Edit: this also applies to gh issue create
Reacted by Blaž Hrastnik, Sindre Johansen, Martin Polden, Howard Huang, François Beausoleil, Jason Karns, Rasmus Bergström, Jouke van der Maas, Rufus Pollock, Christopher Joslyn and 30 more
changed the title [-]Skip PR creation prompt completely & open the editor instead[/-][+]Skip PR/issue creation prompt completely & open the editor instead[/+]on Feb 12, 2020
+1 and it would be important for me that i could set this as the default behaviour - I don't want to have to add an extra flag every time i open an issue etc. (And thanks for all the work on this and hub!)
Reacted by Ahmed El Gabri, Gibson Fahnestock, François Beausoleil, Khai Do and Tom Vendolsky
For PRs, since there is now no prompt to choose a push destination, the user will have to git push before invoking gh pr create --editor. Would there be a better way we could handle this?
If --fill was also used for PRs, open the editor with the pre-filled contents that would normally be submitted without the --editor flag. If one exists, the PR template contents should also be added so it's available for editing. Ref. Unwrap commit message body when using gh pr create --fill #1446
Then, in the future, we can separately consider adding --editor to other commands too where we currently prompt for title & body, like in release create.
For PRs, since there is now no prompt to choose a push destination, the user will have to git push before invoking gh pr create --editor. Would there be a better way we could handle this?
hub has flags: -p for push and -d for draft, which I use often.
_
# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.## On branch main# Your branch is up to date with 'origin/main'.## Changes to be committed:# new file: promote-release.sh## Untracked files:# whatever#
The git commit experience is the best I can think to imitate so as not to leave the user guessing what comes next.
should users be able to exit without creating an issue or PR? for example, exit with an empty message to cancel
what should gh issue create emit once the editor is closed?
should we show title, body, and/or both?
emit a confirmation prompt?
what about other metadata? (assignees, labels, projects, milestone)
what kind of configuration option could be added to default to --editor experience without having to provide the flag? should there be separate flags for gh issue create vs gh pr create
Thanks for listing discussion points!
The followings are my opinion.
Should the editor support similar git commit experience emitting clean up hint that is cleaned up after exiting?
It sounds good and friendly.
I image to use html comment with some marks.
<!-- (gh)
hint message
(gh) -->
(Though I don't know whether it's required in the first implementation)
should users be able to exit without creating an issue or PR?
for example, exit with an empty message to cancel
I think it's sufficient raising an error when it cannot be created, like gh issue comment --editor.
$ gh issue comment --editor 1
GraphQL: Body cannot be blank (addComment)
Also, some text editor have the way to exit with specific error code.
For example vim's :cquit.
what should gh issue create emit once the editor is closed?
I don't expect any prompts and title, body, since I think --editor experience is similar to using --title and --body.
Personally, I'd like to use issue/PR template and frontmatter if supporting metadata.
what kind of configuration option could be added to default to --editor experience without having to provide the flag? should there be separate flags for gh issue create vs gh pr create
@andyfeller I mostly agree with @notomo but I have some minor differences
should users be able to exit without creating an issue or PR?
for example, exit with an empty message to cancel
I think it's sufficient raising an error when it cannot be created, like gh issue comment --editor.
$ gh issue comment --editor 1
GraphQL: Body cannot be blank (addComment)
I think this is too verbose, especially if I'm exiting the editor with something like :cquit I think a more friendly error could be something along these lines
Aborting creating a pull-request/issue/comment
Unless it's a real error then yeah showing that is better.
what should gh issue create emit once the editor is closed?
I don't expect any prompts and title, body, since I think --editor experience is similar to using --title and --body. Personally, I'd like to use issue/PR template and frontmatter if supporting metadata.
I'm fine with just printing the PR/Issue/Comment URL
what kind of configuration option could be added to default to --editor experience without having to provide the flag?
My first idea was maybe something like skip_prompt but I see here there is already a prompt: boolean config, would it be possible to use this?
true (default): enable prompts (CLI --editor flag should override this)
false: disable prompts
should there be separate flags for gh issue create vs gh pr create
No, I think it should be the same flag for both (or any command that might need this workflow)
@notomo@ahmedelgabri : thank you both for the follow up! 🤗 I'm 80% in agreement with the ideas raised with the only area of concern being configuration aspect.
Exiting without creating an issue / PR
should users be able to exit without creating an issue or PR?
for example, exit with an empty message to cancel
I think it's sufficient raising an error when it cannot be created, like gh issue comment --editor.
$ gh issue comment --editor 1
GraphQL: Body cannot be blank (addComment)
I think this is too verbose, especially if I'm exiting the editor with something like :cquit I think a more friendly error could be something along these lines
Aborting creating a pull-request/issue/comment
Unless it's a real error then yeah showing that is better.
👍 I think this exit message is more appropriate
Post-editing experience
what should gh issue create emit once the editor is closed?
I don't expect any prompts and title, body, since I think --editor experience is similar to using --title and --body. Personally, I'd like to use issue/PR template and frontmatter if supporting metadata.
I'm fine with just printing the PR/Issue/Comment URL
👍 This is a fair and consistent call out
Configuration
should there be separate flags for gh issue create vs gh pr create
No, I think it should be the same flag for both (or any command that might need this workflow)
Re-reading this, let me clarify what I intended to ask: should there be separate gh config values for gh issue create vs gh pr create? In other words, are users wanting editor experience all or nothing?
I imagine initially making it all or nothing then separate if/when feedback pops up makes sense.
what kind of configuration option could be added to default to --editor experience without having to provide the flag?
My first idea was maybe something like skip_prompt but I see here there is already a prompt: boolean config, would it be possible to use this?
true (default): enable prompts (CLI --editor flag should override this)
false: disable prompts
My knee jerk thought 🤔 is keeping existing configuration value behaviors as-is and having a separate configuration value. The editor experience being discussed here is really just a different type of prompt that is customized by editor configuration value. I don't think everyone would assume the editor experience by default.
What do you think about:
- `prefer_editor_prompt`: toggle preference for editor-based interactive prompting in the terminal {enabled|disabled} (default disabled)
I imagine initially making it all or nothing then separate if/when feedback pops up makes sense.
Yeah, makes sense
My knee jerk thought 🤔 is keeping existing configuration value behaviors as-is and having a separate configuration value. The editor experience being discussed here is really just a different type of prompt that is customized by editor configuration value. I don't think everyone would assume the editor experience by default.
What do you think about:
- `prefer_editor_prompt`: toggle preference for editor-based interactive prompting in the terminal {enabled|disabled} (default disabled)
Fine by me too, I'm just a bit allergic to the explosion of options/settings. But you folks know more here than I do.
(Though I don't know whether it's required in the first implementation)
I'm open to ideas; I think the main question is how reliable of removing the comments will be. 🤷
Originally, I was thinking of how git commit works strictly because it was the only similar experience I could recall. That said, git doesn't have to deal with markdown such as headers beginning with # which is kind of the point of markdown much less issue and PR bodies.
With all of that said, I think we have talked about the biggest concerns that come to mind.
That said, git doesn't have to deal with markdown such as headers beginning with # which is kind of the point of markdown much less issue and PR bodies.
I don't even think that gh should care about this, it should respect what's set in core.commentchar and that's it, no?
That said, git doesn't have to deal with markdown such as headers beginning with # which is kind of the point of markdown much less issue and PR bodies.
I don't even think that gh should care about this, it should respect what's set in core.commentchar and that's it, no?
I think there is a little confusion, let me try to clarify:
I was drawing inspiration from git commit experience for gh issue create / gh pr create discussion which defaults to using # for comments
gh definitely doesn't care about how git commit works and defers to users' git config preferences when we invoke git externally
gh issue create --editor does care about Markdown and # is meaningful to Markdown
beyond @notomo idea of leaving user guidance in the form of HTML comments, I was wondering if some other character could be use to simulate git commit like comments like maybe ; that can be more reliably stripped out after closing the gh issue create --editor experience
So something like:
; Please enter the title and body for your issue, separated by
; an empty line. Lines starting with ';' will be ignored, and an
; empty message aborts the creation process.
;
; On repo cli/cli
It makes for a good demarcation point and avoids the need to bother with choosing a comment character or parsing every line.
The other nice thing is that it makes it relatively straightforward to append things to this file (like the commit messages of the commits in the PR) without needing to do any special handling. This is another feature from hub that I miss. See #8018.
It makes for a good demarcation point and avoids the need to bother with choosing a comment character or parsing every line.
TIL! I appreciate this novel approach ❤ Wanting to ensure there's some room for experimentation, I think there's enough ideas to provide guidance on the work.
With all of that being said, I think theres enough context to unblock any contribution:
New gh config value that users can enable that would prefer editor experience where applicable
New editor experience to gh issue create triggered by new --editor flag or new gh config value
New editor experience to gh pr create triggered by new --editor flag or new gh config value
Editor experience having some way to capture instruction that can be ignored upon submission
Editor experience having some way to cancel creation through empty message
Editor experience resulting in a web link to the resulting issue or PR
Is there anything else missing?
Reacted by Joe Shaw, David Marchante, notomo, Ahmed El Gabri, Jonathan A. Sternberg, Shubham Dhama and Waldir Pimenta
changed the title [-]Skip PR/issue creation prompt completely & open the editor instead[/-][+]Skip issue creation prompt completely & open the editor instead[/+]on Jul 12, 2024
With #7193 focused on gh issue create --editor, I've split off the PR experience into #9310 so we can avoid dragging out this issue and the related PR. 👍
Reacted by notomo, Gibson Fahnestock and Waldir Pimenta
Activity
[-]Skip PR creation prompt completely & open the editor instead[/-][+]Skip PR/issue creation prompt completely & open the editor instead[/+]francois commentedon Feb 17, 2020
Yup, this is something very important for me. We discussed this in #216.
waldyrious commentedon Feb 20, 2020
I'd like this behavior to be configurable, if implemented. The interactive prompts can be more friendly for beginners.
rufuspollock commentedon Apr 4, 2020
+1 and it would be important for me that i could set this as the default behaviour - I don't want to have to add an extra flag every time i open an issue etc. (And thanks for all the work on this and hub!)
mislav commentedon Feb 9, 2022
Thanks for everyone's patience! We've just discussed this and given it a green light to proceed:
--editorflag, likeissue commentalready has:issue createissue editpr createpr editgit pushbefore invokinggh pr create --editor. Would there be a better way we could handle this?--fillwas also used for PRs, open the editor with the pre-filled contents that would normally be submitted without the--editorflag. If one exists, the PR template contents should also be added so it's available for editing. Ref. Unwrap commit message body when usinggh pr create --fill#1446Then, in the future, we can separately consider adding
--editorto other commands too where we currently prompt for title & body, like inrelease create.Ref. #535
Duologic commentedon Mar 3, 2022
hubhas flags:-pfor push and-dfor draft, which I use often.jglick commentedon May 4, 2022
Would like a fully automatic mode that would allow
--fill(or--body+--title) to immediately push the branch and file the PR with no prompts.6 remaining items
andyfeller commentedon Jun 14, 2024
@robinbowes @notomo @ahmedelgabri @francois @waldyrious : reviewing the #7193 PR, I wanted to pull some of the questions out of the PR and back here to understand exactly what this experience might look like.
Should the editor support similar
git commitexperience emitting clean up hint that is cleaned up (implementation) after exiting?The
git commitexperience is the best I can think to imitate so as not to leave the user guessing what comes next.should users be able to exit without creating an issue or PR?
for example, exit with an empty message to cancel
what should
gh issue createemit once the editor is closed?what kind of configuration option could be added to default to
--editorexperience without having to provide the flag? should there be separate flags forgh issue createvsgh pr createnotomo commentedon Jun 15, 2024
Thanks for listing discussion points!
The followings are my opinion.
It sounds good and friendly.
I image to use html comment with some marks.
(Though I don't know whether it's required in the first implementation)
I think it's sufficient raising an error when it cannot be created, like
gh issue comment --editor.Also, some text editor have the way to exit with specific error code.
For example vim's
:cquit.I don't expect any prompts and title, body, since I think
--editorexperience is similar to using--titleand--body.Personally, I'd like to use issue/PR template and frontmatter if supporting metadata.
Hmm, I have no idea with config.
ahmedelgabri commentedon Jun 15, 2024
@andyfeller I mostly agree with @notomo but I have some minor differences
I think this is too verbose, especially if I'm exiting the editor with something like
:cquitI think a more friendly error could be something along these linesUnless it's a real error then yeah showing that is better.
I'm fine with just printing the PR/Issue/Comment URL
My first idea was maybe something like
skip_promptbut I see here there is already aprompt: booleanconfig, would it be possible to use this?true(default): enable prompts (CLI--editorflag should override this)false: disable promptsNo, I think it should be the same flag for both (or any command that might need this workflow)
andyfeller commentedon Jun 25, 2024
@notomo @ahmedelgabri : thank you both for the follow up! 🤗 I'm 80% in agreement with the ideas raised with the only area of concern being configuration aspect.
Exiting without creating an issue / PR
👍 I think this exit message is more appropriate
Post-editing experience
👍 This is a fair and consistent call out
Configuration
Re-reading this, let me clarify what I intended to ask: should there be separate
gh configvalues for gh issue create vs gh pr create? In other words, are users wanting editor experience all or nothing?I imagine initially making it all or nothing then separate if/when feedback pops up makes sense.
My knee jerk thought 🤔 is keeping existing configuration value behaviors as-is and having a separate configuration value. The editor experience being discussed here is really just a different type of prompt that is customized by
editorconfiguration value. I don't think everyone would assume the editor experience by default.What do you think about:
ahmedelgabri commentedon Jun 25, 2024
Yeah, makes sense
Fine by me too, I'm just a bit allergic to the explosion of options/settings. But you folks know more here than I do.
andyfeller commentedon Jun 25, 2024
I'm open to ideas; I think the main question is how reliable of removing the comments will be. 🤷
Originally, I was thinking of how
git commitworks strictly because it was the only similar experience I could recall. That said,gitdoesn't have to deal with markdown such as headers beginning with#which is kind of the point of markdown much less issue and PR bodies.With all of that said, I think we have talked about the biggest concerns that come to mind.
ahmedelgabri commentedon Jun 25, 2024
I don't even think that
ghshould care about this, it should respect what's set incore.commentcharand that's it, no?andyfeller commentedon Jun 25, 2024
I think there is a little confusion, let me try to clarify:
git commitexperience forgh issue create/gh pr creatediscussion which defaults to using#for commentsghdefinitely doesn't care about howgit commitworks and defers to users'git configpreferences when we invokegitexternallygh issue create --editordoes care about Markdown and#is meaningful to Markdowngit commitlike comments like maybe;that can be more reliably stripped out after closing thegh issue create --editorexperienceSo something like:
joeshaw commentedon Jun 25, 2024
hubused to insert a line below which everything was ignored. https://github.com/mislav/hub/blob/master/github/editor.go#L18 and https://github.com/mislav/hub/blob/master/github/editor.go#L59-L69It makes for a good demarcation point and avoids the need to bother with choosing a comment character or parsing every line.
The other nice thing is that it makes it relatively straightforward to append things to this file (like the commit messages of the commits in the PR) without needing to do any special handling. This is another feature from
hubthat I miss. See #8018.notomo commentedon Jun 25, 2024
The advantage of using html comments is that it is supported by markdown syntax highlighting.
But I'm not too particular about this method.
It make sense.
andyfeller commentedon Jun 26, 2024
TIL! I appreciate this novel approach ❤ Wanting to ensure there's some room for experimentation, I think there's enough ideas to provide guidance on the work.
With all of that being said, I think theres enough context to unblock any contribution:
gh configvalue that users can enable that would prefer editor experience where applicablegh issue createtriggered by new--editorflag or newgh configvaluegh pr createtriggered by new--editorflag or newgh configvalueIs there anything else missing?
[-]Skip PR/issue creation prompt completely & open the editor instead[/-][+]Skip issue creation prompt completely & open the editor instead[/+]andyfeller commentedon Jul 12, 2024
With #7193 focused on
gh issue create --editor, I've split off the PR experience into #9310 so we can avoid dragging out this issue and the related PR. 👍