Files
C_C++
Haskell
Java
LaTeX
Misc.
avalonia_hw
bash_history_abuse
cmdtest
cross_compile
gdb_pretty_print
my_git_repo
rasterpython_eremias++
terribly_old_scripts
aslr-set
bashrc-backup.sh
bashrc-load.sh
escspace
filimg
gif2a
history-backup.sh
imgNamer
inputrc-backup.sh
ipv6-get
ipv6-toggle
mkcpp
mkhtml
mkmake
mkthread
openie
python-backup.sh
tarball_from_project
a.kts
bind_test.sh
cafebabe
ceasar.adb
cluster.dot
cluster.png
comprehensions.adb
crasher.puml
dot.dot
elif_problem.eax
embeded_bake.md
example.m4
extension_cut.Makefile
fizzbuzz.f90
girl_vs_pig_scrapper.py
gitea_mass_create.sh
guards.hs
guitarist.puml
hello.pl
hw.pl
i.sixel
man2png
nesting.puml
opener.c
script_help_for_xolatile.sh
strategy.cs
test.info
test.texi
top_level.cs
Python
Vim
Webdev
git
.gitignore
Makefile
tests/Misc./terribly_old_scripts/mkthread

69 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
readonly FILE_MANAGER="thunar"
if [[ -z $EDITOR ]]; then
readonly EDITOR="vim"
fi
readonly THREAD_FOLDER="/home/jacob/mm/Threads"
readonly RED="\33[31m"
readonly YELLOW="\33[33m"
readonly BOLD="\33[1m"
readonly NORMAL="\33[0m"
enable -n echo
SUBFOLDER=""
NAME=""
function help(){
echo -e " ${BOLD}Script for setting up thread enviremnts as fast as possible.${NORMAL}"
echo ""
echo -e "${YELLOW} mkthread [options]${NORMAL}"
echo " -h : print help message"
echo " -f [string] : specify subfolder"
echo " -o [file] : specify thread name; mandatory"
}
function syn_error(){
echo -e "${RED}Incoherent syntax.${NORMAL}"
exit 2
}
while getopts "hf:o:" opt; do
case "$opt" in
h) help; exit ;;
f)
SUBFOLDER=${OPTARG}
;;
o)
NAME=${OPTARG}
;;
*) syn_error ;;
esac
done
if [[ $NAME == "" ]]; then
syn_error
fi
cd "$THREAD_FOLDER"
if ! [[ $SUBFOLDER == "" ]]; then
if ! [[ -d $SUBFOLDER ]]; then
mkdir $SUBFOLDER
fi
cd "./$SUBFOLDER"
fi
mkdir $NAME
cd $NAME
touch $NAME.cdd
$FILE_MANAGER .
$EDITOR $NAME.cdd