Improved Argument Parser to stop the bot instantly
This commit is contained in:
parent
c1a364445a
commit
b758ee7c7d
12
run.py
12
run.py
|
@ -57,21 +57,25 @@ async def train():
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print("Logged in!")
|
print("Logged in!")
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
|
args.pop(0)
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if arg == "--help" or "-?":
|
if arg == "--help" or arg == "-?":
|
||||||
printhelp()
|
printhelp()
|
||||||
await bot.close()
|
await bot.close()
|
||||||
if arg == "--version" or "-v":
|
raise SystemExit(0)
|
||||||
|
if arg == "--version" or arg == "-v":
|
||||||
printversion()
|
printversion()
|
||||||
await bot.close()
|
await bot.close()
|
||||||
if arg == "--download" or "-d":
|
raise SystemExit(0)
|
||||||
|
if arg == "--download" or arg == "-d":
|
||||||
tasks[0] = True
|
tasks[0] = True
|
||||||
if arg == "--train" or "-t":
|
if arg == "--train" or arg == "-t":
|
||||||
tasks[1] = True
|
tasks[1] = True
|
||||||
else:
|
else:
|
||||||
print(f"Unexspected {arg}")
|
print(f"Unexspected {arg}")
|
||||||
printhelp()
|
printhelp()
|
||||||
await bot.close()
|
await bot.close()
|
||||||
|
raise SystemExit(1)
|
||||||
if tasks[0]:
|
if tasks[0]:
|
||||||
await download()
|
await download()
|
||||||
if tasks[1]:
|
if tasks[1]:
|
||||||
|
|
Loading…
Reference in a new issue