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

Adding a subcommand to be able to comment issue #2082

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kubek2k
Copy link

@kubek2k kubek2k commented Mar 15, 2019

The subcommand of form:

hub issue comment <issueNo> 

that will allow to add comments to the issueNo

@kubek2k kubek2k force-pushed the comment-issue-subcommand branch 2 times, most recently from abe20d6 to 091cbb9 Compare Mar 15, 2019
@kubek2k
Copy link
Author

kubek2k commented Mar 15, 2019

I am not sure if in current setup testing this is even doable (without some http stubs and stuff like that)

@CMB
Copy link

CMB commented Aug 15, 2019

I'm the author of cligh, another command-line tool for GitHub: https://github.com/CMB/cligh

My cligh tool has this feature, and I'd love to see it added to the hub tool, along with any other cligh functionality that is missing. hub is the better tool, and I'd really like to discontinue the cligh utility. I'll see if I can make some pull requests soon.

@mislav mislav added the feature label Aug 19, 2019
@keroro520
Copy link

keroro520 commented Aug 22, 2019

What is the status of this PR? Seems out of dated. Any plan to merge this feature? @kubek2k

@kubek2k
Copy link
Author

kubek2k commented Aug 22, 2019

@keroro520 I am not the one to decide to merge it. Should I make it working @mislav?

@mislav
Copy link
Member

mislav commented Aug 22, 2019

@kubek2k I've only now had time to more thoroughly review it, sorry. Looks great so far! It would be nice if you could merge latest master into this branch and add some tests (it shouldn't be hard; look at features/issue* or features/release* for inspiration).

@kubek2k
Copy link
Author

kubek2k commented Aug 26, 2019

@mislav I will give it a look

@kubek2k kubek2k force-pushed the comment-issue-subcommand branch from 091cbb9 to e7a34a1 Compare Aug 26, 2019
Copy link
Member

@mislav mislav left a comment

This looks great! A couple of polishes before this can go out

}

res, err := api.PostJSON(fmt.Sprintf("repos/%s/%s/issues/%s/comments", project.Owner, project.Name, issueNumber), params)
if err = checkStatus(201, "creating issue", res, err); err != nil {
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err = checkStatus(201, "creating issue", res, err); err != nil {
if err = checkStatus(201, "creating issue comment", res, err); err != nil {


args.NoForward()
if args.Noop {
ui.Printf("Would add a comment, to the issue %s: %s", issueNumber, message)
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about simplifying this sentence and having a newline between first line and comment text?

Suggested change
ui.Printf("Would add a comment, to the issue %s: %s", issueNumber, message)
ui.Printf("Would comment on issue %s:\n%s", issueNumber, message)

Run: addComment,
KnownFlags: `
-m, --message MSG
-f, --file
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary to indicate to the args parser that -f and --file flags expect a value:

Suggested change
-f, --file
-f, --file FILE

gh := github.NewClient(project.Host)

commentBuilder := &github.CommentBuilder{
Filename: "ISSUE_EDITMSG",
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it doesn't conflict with the ISSUE_EDITMSG file potentially left over from creating an issue:

Suggested change
Filename: "ISSUE_EDITMSG",
Filename: "ISSUE_COMMENT_EDITMSG",

@@ -37,6 +38,9 @@ With no arguments, show a list of open issues.
* _labels_:
List the labels available in this repository.

* _comment_:
Adds a comment to the issue specified by <NUMBER>.
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Adds a comment to the issue specified by <NUMBER>.
Add a comment to the issue specified by <NUMBER>.

"regexp"
)

type CommentBuilder struct {
Copy link
Member

@mislav mislav Sep 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bummer that you had to construct a whole new type to avoid the title vs. body splitting that is inherent in MessageBuilder. I'd like to help you avoid having to do this, but first I would have to refactor MessageBuilder a bit. Leave your approach as-is for now, please, until I think about how this can be done.

@cgbahk
Copy link

cgbahk commented Jun 23, 2020

I love to see this feature on master. Anyone working on this now?

@cwegener
Copy link

cwegener commented Dec 20, 2020

@kubek2k Did you ever have a look at the changes requested by @mislav ?

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

Successfully merging this pull request may close these issues.

None yet

6 participants