-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (30 loc) · 1.1 KB
/
Copy pathmain.py
File metadata and controls
37 lines (30 loc) · 1.1 KB
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
from zipfile import ZipFile
from sys import argv
from os.path import exists
from window_mode import Window
from terminal import MyTerminal
def main():
if len(argv) > 1:
config_file = argv[1]
else:
print("Отсутствует необходимый аргумент: путь к конфигурационному файлу")
return
if exists(config_file):
with open(config_file) as config:
fs_path = config.readline().strip()
else:
print("Конфигурационный файл с таким названием отсутствует")
return
if exists(fs_path):
with ZipFile(fs_path, 'a') as file_system:
terminal = MyTerminal(file_system)
if len(argv) > 2 and argv[2] == '-cli':
terminal.start_polling()
else:
window = Window(terminal)
window.start_polling()
else:
print("Модель файловой системы с таким названием отсутствует")
return
if __name__ == '__main__':
main()