1

Using Magit Forge, I'd like to create a new label for a new issue. I can edit the Labels field using command forge-edit-topic-labels, but that command accepts only labels that already exist. How can I create a new label?

1

There's no support for that. I feel this is the sort of thing that one has to do infrequently enough for it to be okay to have to do it using the web interface.

| improve this answer | |
2

I agree with tarsius that Forge doesn't appear to support that operation, but I disagree with his philosophy slightly. If a feature that doesn't exist would be useful to you, you should create it! I so rarely label github issues that I've never thought to create a label from within Magit, but maybe I can help some.

The API endpoint you need is documented at https://developer.github.com/v3/issues/labels/#create-a-label; it looks quite straight forward, and certainly Forge will already have done all the hard work with authentication and so on.

From a quick scan through the code, it looks like you would have to add two new functions. First you should add one called forge--add-new-label, which is responsible for sending the API request to github. All the functions of this type appear to call forge--ghub-post with a URL of the API endpoint and the data that needs to be posted.

The second function should probably be called forge-add-new-label; it will be the interactive function that prompts the user to input the name of the label, a color, and a description. It will then call forge--add-new-label to post the data. I recommend looking at forge-create-mark; it prompts for similar information. The stuff it does with faces is unnecessary though; that's for local display of the mark.

| improve this answer | |
  • 2
    The "philosophy" is just "prioritize things". If someone else implement it, then I most likely would merge it. – tarsius Oct 5 at 13:20
  • 2
    I didn't recognize you, @tarsius! Of course you have priorities; that's to be expected. It's merely my hope that other users with other priorities will learn to contribute, so that over time the software will grow beyond what can be accomplished by any one person. Thanks! – db48x Oct 8 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.