-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddModule.py
More file actions
34 lines (23 loc) · 879 Bytes
/
addModule.py
File metadata and controls
34 lines (23 loc) · 879 Bytes
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
import os
import shutil
# Constants
MODULES_FOLDER = "modules"
GITHUB_REPO = "https://github.com/rootstrap/flutter-modules.git"
def add_module(module_name):
# Create a temporary directory to clone the repository
temp_dir = "/Users/Shared"
module_branch = f"module/{module_name}"
current_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(temp_dir)
os.system(f"git clone -b {module_branch} {GITHUB_REPO}")
shutil.copytree(f"/Users/Shared/flutter-base/modules/{module_name}",
f"{current_dir}/modules/{module_name}")
# Clean up the temporary directory
shutil.rmtree(f"{temp_dir}/flutter-base")
print(f"Module '{module_name}' added successfully.")
# Main function
def main():
module_name = input("Add module. \n Enter module name: ")
add_module(module_name)
if __name__ == "__main__":
main()