From 057b36bf5b5592cca2db25b6715555e4e3949139 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 8 Mar 2021 15:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8Fcmd=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0url=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_cmd.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/parts/scenes/app_cmd.lua b/parts/scenes/app_cmd.lua index 31dda1fe..3775391a 100644 --- a/parts/scenes/app_cmd.lua +++ b/parts/scenes/app_cmd.lua @@ -120,6 +120,14 @@ do--commands.help(arg) "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={ description="Clear the log output.", details={ @@ -223,6 +231,7 @@ do--commands.help(arg) "#", "exit", "echo", + "url", "cls", "rst", "shutdown", @@ -264,7 +273,16 @@ end function commands.shutdown(arg)os.execute("shutdown "..arg)end function commands.cls()outputBox:clear()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.quit=backScene commands.bye=backScene