Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created December 17, 2010 00:16
Show Gist options
  • Save subtleGradient/744260 to your computer and use it in GitHub Desktop.
Save subtleGradient/744260 to your computer and use it in GitHub Desktop.
Jira CLI with git config support! + stuff
#!/usr/bin/env bash
# Author: Thomas Aylott <[email protected]>
# Usage:|
# git-jira getIssue
# git-jira getComments
# Notes:|
# This expects you to use branch names like "thomas/HUE-123-Make-Things-Awesomer" or "tom-HUE-321-code-stuff"
BRANCH_NAME="$(git symbolic-ref HEAD|sed 's/refs\/heads\///')"
TICKET_ID="$(echo "$BRANCH_NAME"|sed -E 's/^.*[/-]([A-Z]+-[0-9]+).*$/\1/')"
jira --issue "$TICKET_ID" --action "$@"
#!/usr/bin/env bash
BRANCH_NAME="$(git symbolic-ref HEAD|sed 's/refs\/heads\///')"
TICKET_ID="$(echo "$BRANCH_NAME"|sed -E 's/^.*[/-]([A-Z]+-[0-9]+).*$/\1/')"
open "$(git config jira.server)browse/$TICKET_ID"
#!/bin/bash
# Comments
# - Customize for your installation, for instance you might want to add default parameters like the following:
# java -jar release/jira-cli-1.5.0.jar --server http://my-server --user automation --password automation "$@"
java -jar /usr/local/jira-cli-1.5.0/release/jira-cli-1.5.0.jar --server $(git config jira.server) --user $(git config jira.user) --password $(git config jira.password) "$@"
@subtleGradient
Copy link
Author

Then setup your git repo's Jira config without leaking your password all over the place.

cd ~/Projects/MyProjectOfDoom
git config jira.server https://issues.cloudera.org/
git config jira.user taylott
git config jira.password PLACEHOLDER
chmod 600 .git/config
$EDITOR .git/config
# replace PLACEHOLDER with your actual password without saving it to your bash history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment