jira.plugin.zsh 631 B

12345678910111213141516171819202122
  1. # To use: add a .jira-url file in the base of your project
  2. # Setup: cd to/my/project
  3. # echo "https://name.jira.com" >> .jira-url
  4. # Usage: jira # opens a new issue
  5. # jira ABC-123 # Opens an existing issue
  6. open_jira_issue () {
  7. if [ ! -f .jira-url ]; then
  8. echo "There is no .jira-url file in the current directory..."
  9. return 0;
  10. else
  11. jira_url=$(cat .jira-url);
  12. if [ -z "$1" ]; then
  13. echo "Opening new issue";
  14. `open $jira_url/secure/CreateIssue!default.jspa`;
  15. else
  16. echo "Opening issue #$1";
  17. `open $jira_url/issues/$1`;
  18. fi
  19. fi
  20. }
  21. alias jira='open_jira_issue'