Difference between revisions of "Shell (API)"

From ComputerCraft Wiki
Jump to: navigation, search
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].
  
==Methods==
+
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
{| border="1" cellpadding="2" cellspacing="0"
+
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">
!style="background:#EEE" width="200px"|Method name
+
[[File:Grid_disk.png|24px]]&nbsp;&nbsp;
!style="background:#EEE" width="*"|Description
+
Shell (API)
|-
+
</td></tr>
|[[shell.exit]]()
+
 
|Exits the current shell
+
<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>
|-
+
 
|[[shell.dir]]()
+
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.exit]]()</td>
|Returns the directory
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Exits the current shell</td></tr>
|-
+
 
|[[shell.setDir]](path)
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.dir]]()</td>
|Sets the directory
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the directory</td></tr>
|-
+
 
|[[shell.path]]()
+
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setDir]](path)</td>
|Returns the path
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the directory</td></tr>
|-
+
 
|[[shell.setPath]](path)
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.path]]()</td>
|Sets the path
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the path</td></tr>
|-
+
 
|[[shell.resolve]](localpath)
+
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setPath]](path)</td>
|Resolves a local path to an absolute path.
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the path</td></tr>
|-
+
 
|[[shell.resolveProgram]](name)
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.resolve]](localpath)</td>
|Resolves the absolute path to the program whose name you provided.
+
<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>
|[[shell.aliases]]()
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Resolves the absolute path to the program whose name you provided.</td></tr>
|Returns aliases.
+
 
|-
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.aliases]]()</td>
|[[shell.setAlias]](alias, command)
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns aliases.</td></tr>
|Sets an alias.
+
 
|-
+
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.setAlias]](alias, command)</td>
|[[shell.clearAlias]](alias, command)
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets an alias.</td></tr>
|Clears an alias.
+
 
|-
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.clearAlias]](alias, command)</td>
|[[shell.programs]]()
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Clears an alias.</td></tr>
|Returns programs.
+
 
|-
+
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.programs]]()</td>
|[[shell.run]](program, arguments)
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns programs.</td></tr>
|Runs a program.
+
 
|-
+
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[shell.run]](program, arguments)</td>
|[[shell.getRunningProgram]]()
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Runs a program.</td></tr>
|Returns the absolute path to the currently-executing program.
+
 
|-
+
<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.

Grid disk.png   Shell (API)

Method NameDescription
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.