-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-new-project.sh
executable file
·68 lines (67 loc) · 1.61 KB
/
create-new-project.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
function createNew(){
if [ -z $1 ]
then
echo -n 'Please provide name of the project : '
read projectName
else
projectName=$1
fi
if [ -z $2 ]
then
echo -n 'Please provide type of the project: Python-py, Javascript-js, Bash-b : '
read projectType
else
projectType=$2
fi
if [ "$projectType" == "py" ]
then
projectType="Python"
elif [ "$projectType" == 'js' ]
then
projectType="Javascript"
elif [ "$projectType" == "b" ]
then
projectType="Bash"
else
echo 'Usage: create_new [project name] [project type - py or js or b]'
fi
echo 'Project Name : "$projectName"'
echo 'Project Type : "$projectType"'
cd
echo 'into the home directory...'
cd Documents/Projects/$projectType/
if [ ! -d $projectName ]
then
mkdir -p $projectName
fi
echo 'project folder created in home...'
cd $projectName
echo 'into the project folder...'
echo -n 'Do you want to add this project to your Github..? (y/n) : '
read githubDecision
if [ "$githubDecision" == "y" ]
then
cd
python3 .create_new_project.py $projectName $projectType
echo 'Repository created in Github with name $projectName'
cd Documents/Projects/$projectType/$projectName
git init
echo 'git initialisation...'
touch README.md
echo 'readme file created...'
git add .
echo 'files added to git...'
git commit -m 'First Commit'
echo 'commit to git...'
git remote add origin https://github.com/itsmepvr/$projectName.git
echo 'git remote url set...'
git remote -v
echo 'new remote url verified...'
git push origin master
echo 'git push...'
fi
echo 'Done'
code .
echo 'Successfully created project'
}