Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 168 lines (157 sloc) 3.93 KB
#! /bin/bash
# Written by Ankit R Gadiya
# Variables
YEAR=`date +"%Y"`
PWD=`pwd`
# Lock
function lock {
echo "Set directories"
sleep 1
nano ~/.scripts/lock
}
# Githelper
function githelper {
echo "Set directory, username and repos"
sleep 1
nano ~/.scripts/githelper
}
# Task
function task {
mkdir $HOME/Lists
touch $HOME/Lists/tasks.md
echo "Populate the tasks"
sleep 1
}
# Diary
function diary {
cd $HOME
wget https://github.com/ankitrgadiya/simple-jekyll/archive/master.zip
unzip master.zip -d Diary
rm master.zip
cd Diary
mv simple-jekyll-master/* ./
rm -rf simple-jekyll-master/
sed -i -e 's/blog/diary/g' _config.yml
sed -i -e 's/Blog/diary/g' _config.yml
rm _posts/*
git init
git checkout -b $YEAR
git add .
git commit -m "Diary Initiated"
}
function finish {
echo "Done!"
echo "Restart shell"
}
# Copy script into .scripts and add it to path
function script {
mkdir $HOME/.scripts
if [ $# == 0 ]
then
cp $opt $HOME/.scripts
elif [ $# == 1 ]
then
cp $1 $HOME/.scripts
fi
echo "export PATH=$PATH:$HOME/.scripts/" >> $HOME/.bashrc
}
# Error message
function error {
echo "Try again with command line arguments"
echo "For help use --help"
echo "Failed"
}
# Interactive Menu interface
if [ $# == 0 ]
then
OPTIONS="lock githelper task diary"
select opt in $OPTIONS; do
if [ "$opt" = "lock" ]
then
echo "Installing $opt"
script &> /dev/null
lock
finish
exit
elif [ "$opt" = "githelper" ]
then
echo "Installing $opt"
script &> /dev/null
githelper
finish
exit
elif [ "$opt" = "task" ]
then
echo "Installing $opt"
script &> /dev/null
task
finish
exit
elif [ "$opt" = "diary" ]
then
echo "Installing $opt"
script &> /dev/null
diary &> /dev/null
finish
exit
elif [ "$opt" = "gm" ]
then
echo "Installing $opt"
script &> /dev/null
finish
exit
else
echo "Error"
fi
done
elif [ $# != 0 ]
then
if [ "$1" == "lock" ]
then
echo "Installing $1"
script $1 &> /dev/null
lock
finish
elif [ "$1" == "githelper" ]
then
echo "Installing $1"
script $1 &> /dev/null
githelper
finish
elif [ "$1" == "tasks" ]
then
echo "Installing $1"
script $1 &> /dev/null
task
finish
elif [ "$1" == "diary" ]
then
echo "Installing $1"
script $1 &> /dev/null
diary &> /dev/null
finish
elif [ "$1" == "gm"]
then
echo "Installing $1"
script $1 &> /dev/null
finish
elif [ "$1" == "--help" ]
then
echo "╦┌┐┌┌─┐┌┬┐┌─┐┬ ┬ "
echo "║│││└─┐ │ ├─┤│ │ "
echo "╩┘└┘└─┘ ┴ ┴ ┴┴─┘┴─┘"
echo "Usage: install"
echo "For Interactive menu"
echo "install also accept command line argument"
echo "install <script>"
echo "Scripts supported"
echo "* lock"
echo "* githelper"
echo "* tasks"
echo "* diary"
else
error
fi
else
error
fi