|
|
|
# IAT command line usage guide
|
|
|
|
|
|
|
|
# Introduction
|
|
|
|
|
|
|
|
The Interactive AmbientTalk shell understands several command line parameters. This can be helpful to make executable scripts to directly run your Ambienttalk program. The scripts iat.bat or iat.sh already make use of this.
|
|
|
|
The following is an exhaustive list of possible command line options.
|
|
|
|
|
|
|
|
# Details
|
|
|
|
|
|
|
|
`iat` evaluates the code in the argument `file`, if one is given, then enters a read-eval-print loop.
|
|
|
|
Unless -p was specified, then it prints out the last evaluated expression and quits.
|
|
|
|
|
|
|
|
## usage
|
|
|
|
|
|
|
|
iat `[`[file](options]`)` `[## Options
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr><td>*-i*, *--init*</td><td>init-file: specifies which file to load as the preamble of the language (the content of this file is evaluated in the context of the global lexical root). The default initiatisation code file is located at ''at/init/init.at''. This is useful for defining your own "language extensions".</td></tr>
|
|
|
|
<tr><td>*-o*, *--objectpath*</td><td>specifies the objectpath, a list of 'name=directory' pairs separated by ':' (UNIX/Mac) or ';' (Windows) which bind global namespace names to the necessary libraries. The **objectpath** is for AmbientTalk what the classpath is for Java. For each 'name=directory' pair, a slot named ''name'' is added to the global ''lobby'' object, bound to a namespace pointing to the given directory. Hence, evaluating ''lobby.name.foo'' in AmbientTalk enables access to the file ''directory/foo.at''. Thanks to the objectpath, AmbientTalk programs remain free of absolute path names when loading other AmbientTalk files. If this option is present, any setting of the environment variable `AT_OBJECTPATH` is ignored.</td></tr>
|
|
|
|
<tr><td>*-e*, *--eval*</td><td>codestring: evaluates the given codestring and ignores the filename.</td></tr>
|
|
|
|
<tr><td>*-p*, *--print*</td><td>print value of last evaluated expression, then quit instead of entering REPL.</td></tr>
|
|
|
|
<tr><td>*-n*, *--network*</td><td>specify the name of the overlay network to join. Only AmbientTalk VMs started using the same name will be discoverable and will be able to discover this VM. This is primarily useful for debugging or demo purposes, if you don't want other programs to interfere.</td></tr>
|
|
|
|
<tr><td>*-a*, *--ip*</td><td>specify the ip address used for service discovery</td></tr>
|
|
|
|
<tr><td>*-h*, *--help*</td><td>display help, then quit</td></tr>
|
|
|
|
<tr><td>*-v*, *--version*</td><td>display version information, then quit</td></tr>
|
|
|
|
<tr><td>*-q*, *--quiet*</td><td>quiet mode - don't print welcome message or any prompts</td></tr>
|
|
|
|
<tr><td>*-j*, *--nojline*</td><td>disables [http://jline.sourceforge.net JLine](arguments]`) support, useful on platforms that do not support this library such as Android.</td></tr>
|
|
|
|
<tr><td>**-d**, **--Xdebug**</td><td>enables debugging support for all actors created within this AmbientTalk virtual machine.</td></tr>
|
|
|
|
<tr><td>**-l**, **--log**</td><td>specifies the logging priorities for the interpreter execution. Similar to -o option it expects a list of 'loggerName=priority' pairs separated by ':' (UNIX/Mac) or ';' (Windows), where priority is one of DEBUG, WARN, INFO, ERROR, FATAL and logName is one of `at.eventloops`, `at.eventloops.actors`, `at.eventloops.remoterefs`, `at.eventloops.vm`, `at.init`, `at.network`. If 'all' is used as loggerName, the given priority is used for all logs in the system. In absence of this command line parameter, the logging support is initialized with the priorities stored in the `logging.props` file. As a usage example consider 'iat -l all=FATAL:at.network=WARN' where all logs are set to FATAL except for `at.network`which is set to WARN</td></tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
## File
|
|
|
|
|
|
|
|
The contents of this file will be evaluated by AmbientTalk in the context of an object whose lexical scope refers to the `root` object and whose parent is `nil`. The object is accessible by evaluating `self` at top-level.
|
|
|
|
|
|
|
|
## Arguments
|
|
|
|
|
|
|
|
Arguments are passed to the AmbientTalk program. They can be accessed as a table of text values by evaluating `system.argv`.
|
|
|
|
|
|
|
|
## Environment variables
|
|
|
|
|
|
|
|
The following environment variables are used by iat:
|
|
|
|
|| **AT_HOME** || path to the AmbientTalk distribution directory, used to derive init file and at libraries ||
|
|
|
|
|| **AT_OBJECTPATH** || the default objectpath to use, if none is specified using `-o` ||
|
|
|
|
|
|
|
|
## Read-eval-print Loop
|
|
|
|
|
|
|
|
If `-p` was not specified on the command line, after evaluating the main argument file (if any), `iat` goes into a read-eval-print loop (REPL). The REPL prompts the user to input a (single-line) expression, evaluates it upon an `ENTER` key and prints the resulting value.
|
|
|
|
|
|
|
|
Additionally, the REPL recognizes the following "commands":
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr><td>**:q** or **:quit**</td><td>Quit the interpreter, a quicker alternative than evaluating `system.exit`</td></tr>
|
|
|
|
<tr><td>**:l** or **:load** filename</td><td>Load `filename.at` as if it was passed as the main argument file to `iat`. In other words: evaluate the contents of the file in the scope of the global module object (the top-level `self`).</td></tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
## Misc
|
|
|
|
|
|
|
|
During execution of the iat program, the AmbientTalk Lexical root contains an object called 'system'. Command-line arguments are available as a table of text values via 'system.argv'. The system object can be used to perform basic output (system.println) and input (system.readNextLine:catch:) |