-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.py
63 lines (55 loc) · 1.54 KB
/
create.py
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
#!/usr/bin/python3
import os
from dotenv import load_dotenv
import argparse
# Load the Environment Variable
load_dotenv()
# Argument Parsing
parser = argparse.ArgumentParser(
description="Default: Simple HTML Boilerplate Project. \n Pass Arguments to change the type"
)
parser.add_argument("name", help="Name of Your Project")
group = parser.add_mutually_exclusive_group()
group.add_argument(
"-n",
"--nogit",
help="Git is not Initialised in the Project Folder",
action="store_true",
)
group.add_argument(
"-g",
"--git",
help="Git is initialised in the Project Folder (Default)",
action="store_true",
)
parser.add_argument("--version", action="version", version="%(prog)s 1.0")
args = parser.parse_args()
# Get The Data
dir = os.getenv("FILEPATH")
proj_name = args.name
new_dir = os.path.join(dir, proj_name)
# Create and change into the Folder
os.makedirs(new_dir)
os.chdir(new_dir)
commands = [
"git clone https://github.com/h5bp/html5-boilerplate.git .",
"rm -rf .git .github README.md CHANGELOG.md",
"git init",
"git add .",
'git commit -m "First Commit" ',
"code .",
]
ng_commands = [
"git clone https://github.com/h5bp/html5-boilerplate.git .",
"rm -rf .git .github README.md CHANGELOG.md",
"code .",
]
if args.nogit:
for command in ng_commands:
os.system(command)
print("Suscessfully created Project Directory. Git Not Intialised")
else:
for command in commands:
os.system(command)
print("Suscessfully created Project Directory and Git Intialised")
exit()