generated from MaaXYZ/MaaPracticeBoilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_resource.py
39 lines (26 loc) · 834 Bytes
/
check_resource.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
import sys
from typing import List
from pathlib import Path
from maa.resource import Resource
from maa.tasker import Tasker, LoggingLevelEnum
def check(dirs: List[Path]) -> bool:
resource = Resource()
print(f"Checking {len(dirs)} directories...")
for dir in dirs:
print(f"Checking {dir}...")
status = resource.post_path(dir).wait().status()
if not status.succeeded():
print(f"Failed to check {dir}.")
return False
print("All directories checked.")
return True
def main():
if len(sys.argv) < 2:
print("Usage: python configure.py <directory>")
sys.exit(1)
Tasker.set_stdout_level(LoggingLevelEnum.All)
dirs = [Path(arg) for arg in sys.argv[1:]]
if not check(dirs):
sys.exit(1)
if __name__ == "__main__":
main()