This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cyanisaac's profile picture

How to allow for custom program arguments in shell.complete()

Started by cyanisaac, 30 July 2015 - 03:18 AM
cyanisaac #1
Posted 30 July 2015 - 05:18 AM
Hi there!

shell.complete() seems to only allow arguments for a select few programs… Is there any way your programs can be built to have shell.complete() have completions for arguments, or at least general arguments (such as filepaths), or is there a way to add them in using code?

Or do I just have to redo shell.complete(), and if so, how the heck would you do that? :P/>
Lyqyd #2
Posted 30 July 2015 - 05:53 AM
Yes, it's possible. See /rom/startup for usage examples.
MKlegoman357 #3
Posted 30 July 2015 - 06:58 AM
Luckily for you the wiki page has already been written for the function you'll need to use. shell.setCompletionFunction()
cyanisaac #4
Posted 31 July 2015 - 02:52 AM
How would you do file completions though, for instance, having my custom ls program have autocomplete for directories and files? Just wondering :P/>
Lyqyd #5
Posted 31 July 2015 - 02:59 AM
Perhaps with fs.complete? We do have a fairly good wiki. You should check it out some time.
cyanisaac #6
Posted 02 August 2015 - 01:52 AM
Perhaps with fs.complete? We do have a fairly good wiki. You should check it out some time.

Hehe you're funny, I do look at the wiki thankyouverymuch.

This didn't seem to work but I think it is an issue with my code, I will try this later. Thanks for the help :D/>