Codebrahma

Work

Open github network graph from command line

Github's network graph is one most elegant tools to track your project's progress. Open the network graph of you current project with this shell script.

Just type network.

function network(){
    url=$(git remote -v | grep origin | awk 'FNR == 2{print $2}')
    sub_path=$(echo ${url##*github.com})
    project_name=$(echo ${sub_path:1} | rev | cut -c 5- | rev)
    project_url=$(echo "https://github.com/${project_name}/network")
    cowsay "I'm taking you to $(echo ${project_url})"
    python -mwebbrowser $(echo ${project_url})
}

network

With a little more customization.

function open_url(){
  cowsay "I'm taking you to ${1}"
  python -mwebbrowser $1
}

function gh(){
  url=$(git remote -v | grep origin | awk 'FNR == 2{print $2}')
  sub_path=$(echo ${url##*github.com})
  project_name=$(echo ${sub_path:1} | rev | cut -c 5- | rev)
  open_url "https://github.com/${project_name}/${1}"
}
gh # Open repo
gh network # Open network graph
gh pulse # Open repo pulse
gh pulls # Open pull requests
gh branches # Open branch list
gh wiki # Open wiki
Written by
Posted in
Tutorial
Tags
If you want to get more posts like this, join our newsletter