-
Notifications
You must be signed in to change notification settings - Fork 1
/
webtemp
57 lines (49 loc) · 1.57 KB
/
webtemp
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
#!/bin/bash
#type --help to learn what this script does!
htmlPage() {
cat << EOF >> index.html
<!DOCTYPE html>
<html>
<head>
<title>${commandline_args[1]}</title>
<link rel="stylesheet" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script src="js/script.js"></script>
EOF
for argvs in "${commandline_args[@]}";
do
if [ "$argvs" = "--jquery" ]; then
echo " <script src=\"https://code.jquery.com/jquery-3.2.1.min.js\"></script>" >> index.html
fi
done
cat << _EOF_ >> index.html
</body>
</html>
_EOF_
}
commandline_args=("$@")
#---Version---#
if [ "$1" = "-v" -o "$1" = "--version" ]; then
echo "Version 1.0";
#---About & Help---#
elif [ "$1" = "-h" -o "$1" = "--help" ]; then
echo "About Section";
echo "This little script creates a web directory and fills it with an HTML, CSS, and Javascript file. The CSS and Javascript files have been linked to the HTML file for you, saving you an extra bit of time when starting a new website project! To start using this script, type -c YOURFILENAME to create a new project. Type --jquery after YOURFILENAME if you'd like the Jquery CDN added to the HTML file."
#---Create the html, css, and js project---#
elif [ "$1" = "-c" -o "$1" = "--create" ]; then
if [ -z "$2" ]; then
echo "Please add a name for your web project to continue."
else
mkdir "$2"
cd "$2"
mkdir css js
touch index.html css/style.css js/script.js
htmlPage
dir=`pwd`
echo "Web project: $2, has been created at $dir."
fi
else
echo "Command Not Found. If you need help, type '--help'"
fi