fast mouseless git workflow¶
from terminal with remote
todo: finish writing this mess lol
#!/bin/zsh
# standalone - creates gitlab repo
proj_name=$1
# output_dir=$2
# set date (for logging not for the job rundate)
LOGDATE=`date '+%Y-%m-%d %H:%M:%S'`
# start of the script echo host / user / date
echo '----) starting - ' $LOGDATE
echo $HOSTNAME
runuser=$(whoami)
echo $runuser
# add your helpers here
# show functions for console help
show_functions(){
# job help
echo 'function list'
echo 'functions starting with job_ are accepted proj_names'
declare -F
}
# exit if params are jacked
bad_parameters () {
echo >&2 "$@"
echo ' '
echo '----) ending - ' $LOGDATE
show_functions
exit 1
}
# add tasks here
git_go(){
echo ' ----> task one started '
echo ' '
echo 'create project proj_name ' $1
echo " - - - venv"
source ~/venv/bin/activate &&
echo " - - - folder"
# mkdir /home/shane/new/$proj_name && cd /home/shane/new/$proj_name &&
# echo " - - - vscode"
# code . &&
echo " - - - init repo"
git init $proj_name && cd $proj_name &&
echo " - - - add cookiecutters or cookies"
# cookie -t
# cookiecutter
echo " - - - commit"
touch README.md CHANGELOG &&
git add -A && git commit -am "testing $proj_name" &&
echo " - - - create remote"
git push --set-upstream git@gitlab.com:shane0/$proj_name.git master &&
echo " - - - configure remote"
git remote add origin https://gitlab.com/shane0/$proj_name.git &&
echo " - - - show remote"
git config --get remote.origin.url &&
echo " web url https://gitlab.com/shane0/"$proj_name".git"
echo ' ----> task one ended '
echo ' '
}
# tasks to delete it all
# tasks to list them
# tasks to clone or cookiecut
# test_task_two(){
# echo ' ----> task one started '
# echo ' '
# echo 'i got passed ' $1
# echo ' ----> task one ended '
# echo ' '
# }
# add jobs here
# jobs call multiple tasks typically
job_gitproj(){
echo ' ====> test_job started'
echo ' '
git_go $proj_name
echo ' ====> test_job ended'
echo ' '
}
# validation - runs with 1 or 2 parameters - echo usage & exit
echo ' '
echo 'validating parameters '
echo ' '
[ "$#" -lt 1 ] && bad_parameters "usage is proj_name output_dir, $# provided"
[ "$#" -gt 2 ] && bad_parameters "usage is proj_name output_dir, $# parameters ($@) exceeds the maximum"
[ "$#" -ge 1 ] && [ "$#" -le 2 ] && echo $@ && echo ' ' && echo "parameters are valid"
job_gitproj $proj_name
echo ' '
echo '----) ending - ' $LOGDATE
# git remote show &&
# cd /home/shanenull/$proj_name/repo/ &&
# git push --set-upstream git@gitlab.com:shane0/$proj_name-project.git master &&
# git remote show
# git remote get-url origin &&