Skip to content

Instantly share code, notes, and snippets.

@geajack
Created November 28, 2020 13:57
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 geajack/5379eac4b75c61f7a4024362cdd16e93 to your computer and use it in GitHub Desktop.
Save geajack/5379eac4b75c61f7a4024362cdd16e93 to your computer and use it in GitHub Desktop.
#!/bin/bash
findOutput=$(find "/home/jack/Code Project Templates" -maxdepth 1 -type d -printf "|%P")
typeOptions=Empty${findOutput:1}
result=$(zenity --class Code --forms --title "New Project" --text="Create new project" --add-entry="Name" --add-combo="Type" --combo-values "$typeOptions")
if [[ "$result" ]]
then
name=$(echo $result | python3 -c "print(input().split('|')[0])")
type=$(echo $result | python3 -c "print(input().split('|')[1])")
if [[ -z "$name" ]]
then
echo "no entry"
exit 1
fi
echo "Name: $name"
cd ~/Code
mkdir "$name"
cd "$name"
mkdir Codebase
cd Codebase
git init
if [[ "$type" = "Empty" ]]
then
type=""
fi
if [[ ! -z "$type" ]]
then
cp -r "/home/jack/Code Project Templates/$type/"* .
fi
code . &
else
echo "no entry"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment