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
base: master
Are you sure you want to change the base?
Conversation
abe20d6
to
091cbb9
Compare
|
I am not sure if in current setup testing this is even doable (without some http stubs and stuff like that) |
|
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. |
|
What is the status of this PR? Seems out of dated. Any plan to merge this feature? @kubek2k |
|
@keroro520 I am not the one to decide to merge it. Should I make it working @mislav? |
|
@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 |
|
@mislav I will give it a look |
091cbb9
to
e7a34a1
Compare
| } | ||
|
|
||
| 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
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?
| 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 |
There was a problem hiding this comment.
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:
| -f, --file | |
| -f, --file FILE |
| gh := github.NewClient(project.Host) | ||
|
|
||
| commentBuilder := &github.CommentBuilder{ | ||
| Filename: "ISSUE_EDITMSG", |
There was a problem hiding this comment.
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:
| 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>. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Adds a comment to the issue specified by <NUMBER>. | |
| Add a comment to the issue specified by <NUMBER>. |
| "regexp" | ||
| ) | ||
|
|
||
| type CommentBuilder struct { |
There was a problem hiding this comment.
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.
|
I love to see this feature on master. Anyone working on this now? |
The subcommand of form:
that will allow to add comments to the
issueNo