shell.completeProgram

From ComputerCraft Wiki
Revision as of 00:22, 2 August 2015 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=shell.completeProgram |args= {{Type|string}} partial path |returns={{Type|table}} completion list |api=shell |addon=ComputerCraft |desc=Added by...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Grid Redstone.png  Function shell.completeProgram
Added by ComputerCraft 1.74, shell.completeProgram() can be passed a partial file or directory name, and returns a numerically indexed table containing strings that could be used to complete it.

Unlike fs.complete(), it also checks against aliases and programs available via the path environment variable - unless an absolute path beginning with / is specified.

See also: textutils.complete(), shell.complete(), shell.setCompletionFunction(), fs.complete() and help.completeTopic().
Syntax shell.completeProgram(string partial path)
Returns table completion list
Part of ComputerCraft
API shell

Examples

Grid paper.png  Example
Prints a list of suffixes that could be combined with "t" to get script titles.
Code
textutils.tabulate( shell.completeProgram( "t" ) )
Output ime, ype, plus any suffixes for files matching in the current folder.



Grid paper.png  Example
Prints a list of suffixes that could be combined with "/t" to get script titles.
Code
textutils.tabulate( shell.completeProgram( "/t" ) )
Output Any suffixes for files matching in the system root directory only.