1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-13 03:43:08 +00:00

Add cc.shell.completion programWithArgs completion. (#815)

And expand monitor, shell, fg and bg to use it
This commit is contained in:
Wojbie
2021-06-07 23:02:45 +02:00
committed by GitHub
parent 53efd6b303
commit b323db30ee
3 changed files with 78 additions and 13 deletions

View File

@@ -81,9 +81,17 @@ shell.setCompletionFunction("rom/programs/monitor.lua", completion.build(
if previous[2] == "scale" then
return completion.peripheral(shell, text, previous, true)
else
return completion.program(shell, text, previous)
return completion.programWithArgs(shell, text, previous, 3)
end
end
end,
{
function(shell, text, previous)
if previous[2] ~= "scale" then
return completion.programWithArgs(shell, text, previous, 3)
end
end,
many = true,
}
))
shell.setCompletionFunction("rom/programs/move.lua", completion.build(
@@ -98,11 +106,11 @@ shell.setCompletionFunction("rom/programs/rename.lua", completion.build(
{ completion.dirOrFile, true },
completion.dirOrFile
))
shell.setCompletionFunction("rom/programs/shell.lua", completion.build(completion.program))
shell.setCompletionFunction("rom/programs/shell.lua", completion.build({ completion.programWithArgs, 2, many = true }))
shell.setCompletionFunction("rom/programs/type.lua", completion.build(completion.dirOrFile))
shell.setCompletionFunction("rom/programs/set.lua", completion.build({ completion.setting, true }))
shell.setCompletionFunction("rom/programs/advanced/bg.lua", completion.build(completion.program))
shell.setCompletionFunction("rom/programs/advanced/fg.lua", completion.build(completion.program))
shell.setCompletionFunction("rom/programs/advanced/bg.lua", completion.build({ completion.programWithArgs, 2, many = true }))
shell.setCompletionFunction("rom/programs/advanced/fg.lua", completion.build({ completion.programWithArgs, 2, many = true }))
shell.setCompletionFunction("rom/programs/fun/dj.lua", completion.build(
{ completion.choice, { "play", "play ", "stop " } },
completion.peripheral