-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmuffin_studio.py
More file actions
executable file
·63 lines (54 loc) · 1.52 KB
/
muffin_studio.py
File metadata and controls
executable file
·63 lines (54 loc) · 1.52 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
import sys
import subprocess
import modules.new
import modules.util
import modules.project
import modules.run
import modules.wifi
def usage():
print("usage: muffin_studio <command>")
print("Commands:")
for key in cmds:
print("\t" + key + ": " + cmds[key]["desc"])
def debug():
subprocess.run(modules.util.gradle_script() + " installDebug")
subprocess.run("adb")
def find_project():
dir = modules.project.find_project()
if dir is not None:
modules.util.success(f"Found project in directory '{dir}'")
else:
modules.util.error("Could not find any projects nearby")
def attach():
modules.run.attach_debug(modules.util.app_id(modules.project.find_project()))
cmds = {
"new": {
"desc": "Opens the interface to create a new project",
"cmd": modules.new.new_project
},
"project": {
"desc": "Finds the nearest project",
"cmd": find_project
},
"run": {
"desc": "Install and run the project on any connected devices. Run with `--no-build` to start debugging on the remote device",
"cmd": modules.run.run_project
},
"attach": {
"desc": "Read from logcat on the remote device",
"cmd": attach
},
"wifi": {
"desc": "Attach to a device over wifi",
"cmd": modules.wifi.connect
}
}
if len(sys.argv) < 2:
usage()
exit()
if not sys.argv[1] in cmds:
print("Unknown command '" + sys.argv[1] + "'")
usage()
exit()
cmds[sys.argv[1]]["cmd"]()