|Added by ComputerCraft 1.74, shell.complete() can be passed a partial command (as would be typed into the command line of CraftOS), and returns a numerically indexed table filled with strings that could be combined with it to complete the next word. It is primarily called upon by CraftOS, in order to provide its autocomplete functionality.
If the string passed in contains only a single word, then suggestions will simply be suffixes that could be used to create a valid program name. If it contains multiple words, then if the first refers to a script with a completion function registered against it, that function will be used to determine suggestions for the subsequent parameters. For example, a wrapper function for help.completeTopic() is registered as the completion function for the help script; other scripts may have far more complicated completion functions assigned. The default set of such functions are defined within the startup file located within the rom directory (which is loaded by CraftOS during boot).See also: textutils.complete(), fs.complete(), shell.setCompletionFunction(), shell.completeProgram() and help.completeTopic().
|Syntax||shell.complete(string partial command line)|
|Returns||table completion list|
|Using the completion function defined for the "help" script (by rom/startup), returns a list of suffixes that would resolve as command lines when added to the string "help tu".|
for _, match in pairs( shell.complete( "help tu" ) ) do print( match ) end