Difference between revisions of "Shell (API)"
From ComputerCraft Wiki
(Updated to API overview v2) |
Smiley43210 (Talk | contribs) m (Added types, changed arg name for clarification) |
||
Line 15: | Line 15: | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the directory</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the directory</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setDir]](path)</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setDir]]({{type|string}} path)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the directory</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the directory</td></tr> | ||
Line 21: | Line 21: | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the path</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the path</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setPath]](path)</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setPath]]({{type|string}} path)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the path</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the path</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.resolve]](localpath)</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.resolve]]({{type|string}} localpath)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves a local path to an absolute path.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves a local path to an absolute path.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.resolveProgram]](name)</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.resolveProgram]]({{type|string}} name)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves the absolute path to the program whose name you provided.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves the absolute path to the program whose name you provided.</td></tr> | ||
Line 33: | Line 33: | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns aliases.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns aliases.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setAlias]](alias, | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setAlias]]({{type|string}} alias, {{type|string}} program)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets an alias.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets an alias.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.clearAlias]](alias, | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.clearAlias]]({{type|string}} alias, {{type|string}} program)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Clears an alias.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Clears an alias.</td></tr> | ||
Line 42: | Line 42: | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns programs.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns programs.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.run]](program, arguments)</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.run]]({{type|string}} program, {{type|string}} arguments)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Runs a program.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Runs a program.</td></tr> | ||
Revision as of 14:42, 2 May 2013
The shell API allows you to interface with the shell.
Method Name | Description |
shell.exit() | Exits the current shell |
shell.dir() | Returns the directory |
shell.setDir(string path) | Sets the directory |
shell.path() | Returns the path |
shell.setPath(string path) | Sets the path |
shell.resolve(string localpath) | Resolves a local path to an absolute path. |
shell.resolveProgram(string name) | Resolves the absolute path to the program whose name you provided. |
shell.aliases() | Returns aliases. |
shell.setAlias(string alias, string program) | Sets an alias. |
shell.clearAlias(string alias, string program) | Clears an alias. |
shell.programs() | Returns programs. |
shell.run(string program, string arguments) | Runs a program. |
shell.getRunningProgram() | Returns the absolute path to the currently-executing program. |