Skip to content

Instantly share code, notes, and snippets.

@thatkookooguy
Last active April 12, 2018 10:18
Show Gist options
  • Select an option

  • Save thatkookooguy/10e32a45c308ff65be6759960c8af5ed to your computer and use it in GitHub Desktop.

Select an option

Save thatkookooguy/10e32a45c308ff65be6759960c8af5ed to your computer and use it in GitHub Desktop.

dependencies

  1. node.js
  2. brew (optional)

install

  1. run npm install -g git-stats-importer jira-cmd git-stats in your terminal
    • git-stats-importer is used to import git history into git-stats
    • git-stats is used to show your contribution graph
    • jira-cmd is used to show a specific agile board
  2. you need to setup jira-cmd for first use. run the command jira in the terminal and insert the following information:
    $ jira
    Jira URL: xxxxxx
    Username: xxxxxx
    Password: xxxxxx
    Information stored!
    

main commands

There are 3 commands that need to run to see the data:

  1. git-stats-importer --find-repos <repo_directory_path> -e <user_email> &>/dev/null This will go over the repo's git history and search for the <user_email> commits (can add more than one). the output is obvuscated using &>/dev/null. to see output, remove it.
  2. git-stats - display the commit graph should have all the data from git-stats-importer
  3. jira sprint -r <board_name> - show bugs of specific agile board. if you don't have a board for the issues you want to display, you can create one using the following method
    1. go to jira, click on Issues and Search for issues
    2. add your search term, and click Save as. name your search.
    3. on the header, click on Boards, and then View all boards.
    4. click on Create board in the top right corner. In the modal, select Create a Scrum board. select Board from an existing Saved Filter and click Next
    5. give the board an easy name, and search for the saved search we created. click on Create board.
    6. Now that you have a board, you can run the command with the board name jira sprint -r "team omicron bugs"

Showing info everytime you open your terminal

Here's a little snippet to show the contribution graph, jira board, and status of docker containers

###COLOR DEFINITIONS###

BLACK='\e[0;30m'
BLUE='\e[0;34m'
GREEN='\e[0;32m'
CYAN='\e[0;36m'
RED='\e[0;31m'
PURPLE='\e[0;35m'
BROWN='\e[0;33m'
LIGHTGRAY='\e[0;37m'
DARKGRAY='\e[1;30m'
LIGHTBLUE='\e[1;34m'
LIGHTGREEN='\e[1;32m'
LIGHTCYAN='\e[1;36m'
LIGHTRED='\e[1;31m'
MAGENTA='\e[1;35m'
YELLOW='\e[1;33m'
LIGHTYELLOW='\e[0;33m'
WHITE='\e[1;37m'
NC='\e[0m' # No Color

###WELCOME SCREEN###
# update commit data for csp-ui
git-stats-importer --find-repos ~/Development/csp-ui -e nkalman@vmware.com  &>/dev/null
###
echo -ne "Today is, "; date
echo;
echo -ne "${NC}~ CSP CONTRIBUTIONS FOR nkalman@vmware.com ~\n==========================================\n" ; git-stats ; jira sprint -r "team omicron bugs" ;
echo -ne "DOCKER STATUS: ${PURPLE}"
echo;
echo -ne ""; docker ps -a
echo; echo;
echo -ne "${NC}";

additional prints for terminal splash screen

On my terminal splash screen, I also install these dependencies: brew install toilet fortune cowsay

  1. toilet - shows large text titles
  2. fortune - shows a random quote or joke
  3. cowsay - prints a cow in ASCII that says the input you give it

if you run that command, you can use my full splash screen:

###WELCOME SCREEN###
# update commit data for csp-ui
git-stats-importer --find-repos ~/Development/csp-ui -e nkalman@vmware.com  &>/dev/null
###
toilet -f pagga "Hello, $USER"
echo -ne "Today is, "; date
echo;
echo -ne "${NC}~ CSP CONTRIBUTIONS FOR nkalman@vmware.com ~\n==========================================\n" ; git-stats ; jira sprint -r "team omicron bugs" ;
echo -ne "DOCKER STATUS: ${PURPLE}"
echo;
echo -ne ""; docker ps -a
echo; echo;
echo -ne "${RED}"; fortune ;
echo -ne "${NC}";
echo;
echo -ne "${NC}";

You can also show relevant data from GitHub if you're interested. for that, you can install the following tools:

  1. npm install -g ghcal - same contribution graph, happening directly with GitHub data
  2. brew install ghi - show issues from a GitHub repo

how to use

  • including contributions for your user on github: ghcal -u thatkookooguy (supports most of the same parameters as git-stats. run with -h to check)
  • showing issues related to open pull requests on vmware/clarity: ghi list -f all -p -N greenkeeper -S updated -s open -- vmware/clarity

Extras

  • you can change the contribution's graph theme using --light to make it brighter
  • you can show a pie chart of contributions by emails using git-stats --authors. Notice this only works for emails you scanned using git-stats-importer
  • jira-cmd have options to actually do commands in jira:
     $ jira -h
    
     Usage: jira [options] [command]
    
     Commands:
    
      ls [options]           List my issues
      start <issue>          Start working on an issue.
      stop <issue>           Stop working on an issue.
      review <issue> [assignee] Mark issue as being reviewed [by assignee(optional)].
      done [options] <issue> Mark issue as finished.
      invalid <issue>        Mark issue as finished.
      running                List issues in progress.
      jql [options] [query]  Run JQL query
      link <from> <to>       link issues
      search <term>          Find issues.
      assign <issue> [user]  Assign an issue to <user>. Provide only issue# to assign to me
      watch <issue> [user]   Watch an issue to <user>. Provide only issue# to watch to me
      comment <issue> [text] Comment an issue.
      show [options] <issue> Show info about an issue
      open <issue>           Open an issue in a browser
      worklog <issue>        Show worklog about an issue
      worklogadd [options] <issue> <timeSpent> [comment] Log work for an issue
      create [project[-issue]] Create an issue or a sub-task
      new [options] [key]    Create an issue or a sub-task
      config [options]       Change configuration
      sprint [options]       Works with sprint boards
      With no arguments, displays all rapid boards
      With -r argument, attempt to find a single rapid board and display its active sprints
      With both -r and -s arguments attempt to get a single rapidboard/ sprint and show its issues. If a single sprint board isnt found, show all matching sprint boards
    
     Options:
    
      -h, --help     output usage information
      -V, --version  output the version number
    
    • ghi can show the body of the issues\pr using the --verbose flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment