2021-05-12 15:57:22 +02:00
|
|
|
# Starting Retro
|
2019-03-15 13:06:56 +01:00
|
|
|
|
2021-05-12 15:57:22 +02:00
|
|
|
Retro can be run for scripting or interactive use.
|
2019-03-22 12:44:42 +01:00
|
|
|
|
|
|
|
## Interactive
|
|
|
|
|
|
|
|
To start it interactively, run: `retro` without any command line
|
2021-05-10 14:06:48 +02:00
|
|
|
arguments, or with `-i`.
|
2019-03-22 12:44:42 +01:00
|
|
|
|
|
|
|
Starting the interactive system:
|
|
|
|
|
|
|
|
```
|
|
|
|
retro
|
|
|
|
```
|
|
|
|
|
|
|
|
Or:
|
|
|
|
|
|
|
|
```
|
|
|
|
retro -i
|
|
|
|
```
|
|
|
|
|
|
|
|
This should be sufficient for most uses.
|
|
|
|
|
|
|
|
## Using In a Pipe
|
|
|
|
|
2021-05-10 14:06:48 +02:00
|
|
|
Retro will work with piped input.
|
2019-03-22 12:44:42 +01:00
|
|
|
|
|
|
|
E.g.,
|
|
|
|
|
|
|
|
```
|
2021-05-10 14:06:48 +02:00
|
|
|
echo "'lol s:put nl" | retro
|
2019-03-22 12:44:42 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Running A Program In A File
|
|
|
|
|
|
|
|
You can run code in a file very easily. This is simply:
|
|
|
|
|
|
|
|
```
|
|
|
|
retro filename
|
|
|
|
```
|
|
|
|
|
|
|
|
You can follow the filename with any arguments that it may need.
|
2020-10-01 15:28:46 +02:00
|
|
|
These will be accessible to the program via the `script:arguments`
|
|
|
|
and `script:get-argument` words.
|
2019-03-22 12:44:42 +01:00
|
|
|
|
|
|
|
Source files must be written in Unu format.
|
|
|
|
|
|
|
|
## Scripting
|
|
|
|
|
2021-05-12 15:57:22 +02:00
|
|
|
You can use Retro to write scripts. Add a shebang:
|
2019-03-22 12:44:42 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
#!/usr/bin/env retro
|
|
|
|
```
|
|
|
|
|
|
|
|
And make the file executable.
|
|
|
|
|
|
|
|
Source files must be written in Unu format.
|
|
|
|
|
|
|
|
## Command Line Arguments
|
2019-03-15 13:06:56 +01:00
|
|
|
|
|
|
|
For a summary of the full command line arguments available:
|
|
|
|
|
|
|
|
Scripting Usage:
|
|
|
|
|
|
|
|
retro filename [script arguments...]
|
|
|
|
|
|
|
|
Interactive Usage:
|
|
|
|
|
2021-05-10 14:06:48 +02:00
|
|
|
retro [-h] [-i] [-f filename] [-t]
|
2019-03-15 13:06:56 +01:00
|
|
|
|
|
|
|
-h Display this help text
|
|
|
|
-i Interactive mode (line buffered)
|
|
|
|
-f filename Run the contents of the specified file
|
|
|
|
-t Run tests (in ``` blocks) in any loaded files
|