-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
29 lines (19 loc) · 943 Bytes
/
Main.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
import os
from subprocess import call
import shutil
from functions.converter import generate_summary_file
command = input()
# command = "/home/lyonh/Downloads/micro_usd_pipline, micro_usd_pipline, /home/lyonh/Documents"
path_to_trillium_export = command.split(",")[0]
book_name = command.split(",")[-2].replace(" ", "")
book_parent_path = command.split(",")[-1]
book_path = os.path.join(book_parent_path, book_name)[1:]
book_scr_path = os.path.join(book_path, "src")
trillium_important_foulder = os.path.join(path_to_trillium_export, path_to_trillium_export.split("/")[-1])
move_to_book_path = f'cd {book_parent_path}'
cmd = f'{move_to_book_path} && mdbook init {book_name} --title={book_name} --ignore=git'
call(cmd, shell=True)
shutil.rmtree(book_scr_path)
os.mkdir(book_scr_path)
shutil.copytree(trillium_important_foulder, os.path.join(book_scr_path, trillium_important_foulder.split("/")[-1]))
generate_summary_file(book_path)