小程序cmd添加url指令
This commit is contained in:
@@ -120,6 +120,14 @@ do--commands.help(arg)
|
|||||||
"Usage: echo [message]",
|
"Usage: echo [message]",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
url={
|
||||||
|
description="Attempt to open a URL with your device.",
|
||||||
|
details={
|
||||||
|
"Attempt to open a URL with your device.",
|
||||||
|
"",
|
||||||
|
"Usage: url [url]",
|
||||||
|
},
|
||||||
|
},
|
||||||
cls={
|
cls={
|
||||||
description="Clear the log output.",
|
description="Clear the log output.",
|
||||||
details={
|
details={
|
||||||
@@ -223,6 +231,7 @@ do--commands.help(arg)
|
|||||||
"#",
|
"#",
|
||||||
"exit",
|
"exit",
|
||||||
"echo",
|
"echo",
|
||||||
|
"url",
|
||||||
"cls",
|
"cls",
|
||||||
"rst",
|
"rst",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
@@ -264,7 +273,16 @@ end
|
|||||||
function commands.shutdown(arg)os.execute("shutdown "..arg)end
|
function commands.shutdown(arg)os.execute("shutdown "..arg)end
|
||||||
function commands.cls()outputBox:clear()end
|
function commands.cls()outputBox:clear()end
|
||||||
function commands.rst()history,hisPtr={}end
|
function commands.rst()history,hisPtr={}end
|
||||||
commands.echo=log
|
function commands.url(url)
|
||||||
|
if url~=""then
|
||||||
|
local res,err=pcall(love.system.openURL,url)
|
||||||
|
if not res then
|
||||||
|
log{COLOR.R,"[ERR] ",COLOR.W,err}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
log{COLOR.water,"Usage: url [url]"}
|
||||||
|
end
|
||||||
|
end
|
||||||
commands.exit=backScene
|
commands.exit=backScene
|
||||||
commands.quit=backScene
|
commands.quit=backScene
|
||||||
commands.bye=backScene
|
commands.bye=backScene
|
||||||
|
|||||||
Reference in New Issue
Block a user