Difference between revisions of "Shell (API)"
From ComputerCraft Wiki
m (→Methods fix.) |
(Updated to API overview v2) |
||
Line 1: | Line 1: | ||
The shell API allows you to interface with the [http://en.wikipedia.org/wiki/Shell_%28computing%29 shell]. | The shell API allows you to interface with the [http://en.wikipedia.org/wiki/Shell_%28computing%29 shell]. | ||
− | = | + | <table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> |
− | + | <tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;"> | |
− | + | [[File:Grid_disk.png|24px]] | |
− | + | Shell (API) | |
− | + | </td></tr> | |
− | + | ||
− | + | <tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.exit]]()</td> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Exits the current shell</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.dir]]()</td> | |
− | + | <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> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the directory</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.path]]()</td> | |
− | + | <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> | |
− | + | <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> | |
− | + | <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> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves the absolute path to the program whose name you provided.</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.aliases]]()</td> | |
− | + | <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, command)</td> | |
− | + | <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, command)</td> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Clears an alias.</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.programs]]()</td> | |
− | + | <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> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Runs a program.</td></tr> | |
− | + | ||
− | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.getRunningProgram]]()</td> | |
− | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the absolute path to the currently-executing program.</td></tr> | |
+ | </table> | ||
+ | |||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 22:45, 30 November 2012
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(path) | Sets the directory |
shell.path() | Returns the path |
shell.setPath(path) | Sets the path |
shell.resolve(localpath) | Resolves a local path to an absolute path. |
shell.resolveProgram(name) | Resolves the absolute path to the program whose name you provided. |
shell.aliases() | Returns aliases. |
shell.setAlias(alias, command) | Sets an alias. |
shell.clearAlias(alias, command) | Clears an alias. |
shell.programs() | Returns programs. |
shell.run(program, arguments) | Runs a program. |
shell.getRunningProgram() | Returns the absolute path to the currently-executing program. |