Skip to content

Instantly share code, notes, and snippets.

@sushant-hiray
Last active January 1, 2016 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sushant-hiray/8065556 to your computer and use it in GitHub Desktop.
Save sushant-hiray/8065556 to your computer and use it in GitHub Desktop.
How to “Push It Good” to Git

How to “Push It Good” to Git

Works on Linux with MPC configured!

###Instructions###

  • chmod +rx pushit
  • sudo mv pushit /usr/bin/

###Usage###

  • pushit {branch-name}

###Credits###

# Definitions of colors in bash
RESTORE='\033[0m'
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
BLUE='\033[00;34m'
PURPLE='\033[00;35m'
CYAN='\033[00;36m'
LIGHTGRAY='\033[00;37m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
LYELLOW='\033[01;33m'
LBLUE='\033[01;34m'
LPURPLE='\033[01;35m'
LCYAN='\033[01;36m'
WHITE='\033[01;37m'
function colorPrint
{
case $1 in
"WARN")
echo -e "[WARN] ${LRED} $2 ${RESTORE} $3"
;;
"INFO")
echo -e "[INFO] ${LGREEN} $2 ${RESTORE} $3"
;;
"ERROR")
echo -e "[ERROR] ${RED} $2 ${RESTORE} $3"
;;
"DEBUG")
echo -e "[DEBUG] ${YELLOW} $2 ${RESTORE} $3"
;;
"STEP")
echo -e "[STEP] ${BLUE} $2 ${RESTORE} $3"
;;
"TODO")
echo -e "[TODO] ${CYAN} $2 ${RESTORE} $3"
;;
*)
echo -e "[$1] $2 $3"
;;
esac
}
#!/bin/bash
SCRIPT_HOME=$HOME/Music
source $SCRIPT_HOME/colors.sh
currentList=$(mpc -f "[%position%]-[%file%]" playlist)
demanded=$1
colorPrint "INFO" "Searching for" $1
IFS=$'\n'
shopt -s nocasematch
for current in $currentList
do
echo $current | grep $demanded
if [[ $current == *"$demanded"* ]]; then
position=${current%%-*}
colorPrint "INFO" "A matching song is found in playlist at $position"
mpc play $position
exit
fi
done
colorPrint "INFO" "No song found for your query."
#!/bin/bash
git push origin $1
~/Music/mpc_play.sh "push"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment