Skip to content

Commit 06e6e93

Browse files
authored
Merge pull request #31 from JE-Chen/dev
Dev
2 parents 0504184 + 11e7054 commit 06e6e93

File tree

7 files changed

+41
-14
lines changed

7 files changed

+41
-14
lines changed

.idea/workspace.xml

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

je_auto_control/__main__.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@
22
import argparse
33

44
from je_auto_control.utils.json.json_file import read_action_json
5+
from je_auto_control.utils.file_process.get_dir_file_list import get_dir_files_as_list
56
from je_auto_control.utils.executor.action_executor import execute_action
7+
from je_auto_control.utils.executor.action_executor import execute_files
8+
9+
10+
def preprocess_execute_action(file_path: str):
11+
execute_action(read_action_json(file_path))
12+
13+
14+
def preprocess_execute_files(file_path: str):
15+
execute_files(get_dir_files_as_list(file_path))
16+
17+
18+
argparse_event_dict = {
19+
"execute_file": preprocess_execute_action,
20+
"execute_dir": preprocess_execute_files
21+
}
622

723
if __name__ == "__main__":
824
parser = argparse.ArgumentParser()
925
parser.add_argument("-e", "--execute_file", type=str, help="choose action file to execute")
26+
parser.add_argument("-d", "--execute_dir", type=str, help="choose dir include action file to execute")
1027
args = parser.parse_args()
11-
if args.execute_file is not None:
12-
execute_action(read_action_json(args.execute_file))
13-
else:
14-
print("No argument, Hello There :)")
28+
args = vars(args)
29+
print(args)
30+
for key, value in args.items():
31+
if value is not None:
32+
argparse_event_dict.get(key)(value)
33+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control",
8-
version="0.0.87",
8+
version="0.0.88",
99
author="JE-Chen",
1010
author_email="zenmailman@gmail.com",
1111
description="auto testing",

test/unit_test/argparse/argparse_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
print(os.getcwd())
44

55
os.system("cd " + os.getcwd())
6-
os.system("python je_auto_control --execute_file " + os.getcwd() + r"/test/unit_test/argparse/test.json")
7-
8-
6+
os.system("python je_auto_control --execute_file " + os.getcwd() + r"/test/unit_test/argparse/test1.json")
7+
os.system("python je_auto_control --execute_dir " + os.getcwd() + r"/test/unit_test/argparse")

test/unit_test/argparse/test2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[["type_key", {"keycode": 0}], ["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["position"], ["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], ["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]]

test/unit_test/json/json_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}],
1212
]
1313

14-
write_action_json(os.getcwd() + "/test.json", test_list)
15-
read_json = read_action_json(os.getcwd() + "/test.json")
14+
write_action_json(os.getcwd() + "/test1.json", test_list)
15+
read_json = read_action_json(os.getcwd() + "/test1.json")
1616
print(read_json)

0 commit comments

Comments
 (0)