Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mytonctrl/mytonctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ def PreUp(local, ton):

def Installer(args):
# args = ["python3", "/usr/src/mytonctrl/mytoninstaller.py"]
args = ["python3", "-m", "mytoninstaller"]
subprocess.run(args)
cmd = ["python3", "-m", "mytoninstaller"]
if args:
cmd += ["-c", *args]
subprocess.run(cmd)
#end define


Expand Down
21 changes: 19 additions & 2 deletions mytoninstaller/mytoninstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,29 @@ def Event(local, name):
#end define


def General(local):
def Command(local, args, console):
cmd = args[0]
args = args[1:]
for item in console.menu_items:
if cmd == item.cmd:
console._try(item.func, args)
print()
local.exit()
print(console.unknown_cmd)
local.exit()
#end define


def General(local, console):
if "-u" in sys.argv:
ux = sys.argv.index("-u")
user = sys.argv[ux+1]
local.buffer.user = user
Refresh(local)
if "-c" in sys.argv:
cx = sys.argv.index("-c")
args = sys.argv[cx+1:]
Command(local, args, console)
if "-e" in sys.argv:
ex = sys.argv.index("-e")
name = sys.argv[ex+1]
Expand Down Expand Up @@ -282,7 +299,7 @@ def mytoninstaller():

Init(local, console)
if len(sys.argv) > 1:
General(local)
General(local, console)
else:
console.Run()
local.exit()