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 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 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":{}}
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.