From 9e9df37c4006d0f04b673132acbf5bb7433eb4e3 Mon Sep 17 00:00:00 2001 From: Wilma456 Date: Wed, 7 Jun 2017 16:51:23 +0200 Subject: [PATCH] Add autocompletion to exec --- .../resources/assets/computercraft/lua/rom/startup.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/resources/assets/computercraft/lua/rom/startup.lua b/src/main/resources/assets/computercraft/lua/rom/startup.lua index cdc41b4b4..4fd0f0f9f 100644 --- a/src/main/resources/assets/computercraft/lua/rom/startup.lua +++ b/src/main/resources/assets/computercraft/lua/rom/startup.lua @@ -168,6 +168,15 @@ local function completeSet( shell, nIndex, sText, tPreviousText ) return completeMultipleChoice( sText, settings.getNames(), true ) end end +local tCommands +if commands then + tCommands = commands.list() +end +local function completeExec( shell, nIndex, sText, tPreviousText ) + if nIndex == 1 and commands then + return completeMultipleChoice( sText, tCommands, true ) + end +end shell.setCompletionFunction( "rom/programs/alias.lua", completeAlias ) shell.setCompletionFunction( "rom/programs/cd.lua", completeDir ) shell.setCompletionFunction( "rom/programs/copy.lua", completeEitherEither ) @@ -194,6 +203,7 @@ shell.setCompletionFunction( "rom/programs/fun/dj.lua", completeDJ ) shell.setCompletionFunction( "rom/programs/fun/advanced/paint.lua", completeFile ) shell.setCompletionFunction( "rom/programs/http/pastebin.lua", completePastebin ) shell.setCompletionFunction( "rom/programs/rednet/chat.lua", completeChat ) +shell.setCompletionFunction( "rom/programs/command/exec.lua", completeExec ) -- Run autorun files if fs.exists( "/rom/autorun" ) and fs.isDir( "/rom/autorun" ) then