TL;DR, this ensures ~/jira.d is present, with 0755 perms.
If ~/jira.d isn't present, we can't write to the cookieFile, which
breaks CmdLogin. This is particularly an issue when using /etc/go-jira.yml
to get an entire team using go-jira easily :)
This fixes this by ensuring the cookieFile dir is present before
writing to it.
This adds the basics of the component API:
* listing of components assigned to a project
* adding new components to a project.
The interface to 'add component' is similar to that of 'labels', as
previously discussed. We can implement remove/update later.
This adjusts the CmdWatch interface as per discussion in
https://github.com/Netflix-Skunkworks/go-jira/pull/26
It also exposes public versions of the c.getOptString and c.getOptBool
utility functions, again as discussed.
The interface to CmdWatch now includes the user to be watched (rather than
depending on the opt[] map. This makes CmdWatch more useful externally.
A '--remove' option has been created, to allow for removal of a given watcher.
This was deliberately not included in the defaults map, as it is specifically only
used for 'watch' command right now. It should be moved up to a default if it becomes
a more common option, I guess (as 'remove is false' isn't a bad default)
This simplifies the interface to voting, as per the discussion in
https://github.com/Netflix-Skunkworks/go-jira/pull/26
Basically, DRY out the logic into a single CmdVote function based
around an 'up' bool. Similarly, make a single CLI command with an
option to do the downvote.
This adds support for voting on issues via CmdVote() and CmdUnvote()
Voting on issues is always done as the logged in user, it appears you
can't case a vote for another user:
https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addVote
This required adding a cli.delete() handler, naturally with no content
(as per RFC2616)
This is ripe for DRY-ing out, but I will leave that for a future PR.
Worth noting is that you cannot vote for your own issues, this results in:
2016-01-13T21:35:41.315Z ERROR [cli.go:184] response status: 404 Not Found
2016-01-13T21:35:41.315Z ERROR [commands.go:439] Unexpected Response From POST:
{snip}
{"errorMessages":["You cannot vote for an issue you have reported."],"errors":{}}
Support the lowest common denominator for default_edit_template, as per #23
`reporter` is not usually editable by unprivileged users. Even if it is left as-is,
the PUT request is trying to update it, resulting in the following error:
{"errorMessages":[],"errors":{"reporter":"Field 'reporter' cannot be set. It is not on the appropriate screen, or unknown."}}
Commenting out the field leaves the information visible, so is a reasonable compromise.
The CLI looks for commands (like 'labels') in the first two positional args. This
is how commands like 'BLOCKER blocks ISSUE' work.
As per @coryb's comments in #21 - this allows us to support set/add/remove in a
consistent way for other types: components for example.
This commit rearranges the command to be as follows:
jira (set/add/remove) labels ISSUE LABELS...
The options to CmdLabels have been reordered accordingly.
GetTemplate and RunTemplate allow external users to access the template system,
and in particular allow them to provide their own Buffer to write the output to.
I've implemented exposed versions calling the private functions, rather than breaking
the internal API. If this isn't a concern, we should remove getTemplate and runTemplate
in a future commit.
This adds 'labels' command, which allows for the setting, addition and removal
of labels on an issue.
'set' action resets the issue labels to the list provided.
'add' action adds the supplied labels to the issue
'remove' action removes the supplied labels from the issue
The API already gracefully handles duplication, removal of non-existant labels, and the
supplying of an empty list of labels (which is useful in the case of 'set')
Eg
jira labels TEST-123 add label1 label2 label3
jira labels TEST-123 remove label1 label2
jira labels TEST-123 set label1 label2 label3
jira labels TEST-123 set # clears any labels on the issue
jira labels TEST-123 add # no-op
jira labels TEST-123 remove # no-op
This mirrors the functionality of the API.