Created
September 25, 2016 21:22
-
-
Save Alexander-Prime/90daf3b0d4ad3846bdc8d90b71235bf2 to your computer and use it in GitHub Desktop.
A nice command-line utility for Linux livestreamers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##-------------------------------------------------------------------------------- | |
read -rd '' USAGE <<"BOUND" | |
Usage: strim <command> | |
Commands: | |
repo Show the current directory's Github remote on this user's overlay | |
tag Add a tag for this commit with the name "stream-<date>", where <date> is the current date as [yyyymmdd] | |
BOUND | |
##-------------------------------------------------------------------------------- | |
case $1 in | |
## Show the current repository on this user's overlay | |
"repo") | |
LOCAL_USER=`whoami` | |
REMOTE_ADDR="192.168.1.145" | |
REMOTE_FILE="/home/stream/Dev/scenes/$LOCAL_USER-repo.txt" | |
RESULTS=`git remote -v 2>/dev/null | egrep "github.*\(push\)$"` | |
if [[ $RESULTS =~ github\.com:([^\.]+)\.git ]] | |
then | |
REPO="https://github.com/${BASH_REMATCH[1]}" | |
echo "Setting repository URL..." | |
echo -e "\t$LOCAL_USER -> \e[1;92m$REPO\e[0m\n" | |
else | |
REPO="No Github repository for this project" | |
echo "Not in a repository" | |
echo -e "\t$LOCAL_USER -> \e[1;91m[none]\e[0m\n" | |
fi | |
echo -n $REPO | ssh stream@$REMOTE_ADDR "cat > $REMOTE_FILE" | |
;; | |
## Tag the current repository with the date (eg "stream-20160930") | |
"tag") | |
git tag -a stream-`date +%Y%m%d` | |
;; | |
*) | |
echo -e "$USAGE" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment