Command Line

The command line is where the whole journey starts: whether you want to try out something fast in the REPL, or run a script. Or even install extern packages directly.



Using the command line

Run a script

To run an Arturo script, all you have to do is pass the main script's path to Arturo:

arturo <script>

Start the interactive console

To start the interactive console (see: REPL), just open up your terminal and type:

arturo

This is is what Arturo's interactive console looks like:

REPL

Here you may easily try things out and see things first hand. :)

Working with bytecode

Since Arturo is, internally, a bytecode-based VM, it also allows you to save and read bytecode directly.

💡 Bytecode, also termed portable code or p-code, is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normally numeric addresses) that encode the result of compiler parsing and performing semantic analysis of things like type, scope, and nesting depths of program objects.

This way, you will be able to share your code, without sharing your source, or accelerate your script's execution (since when reading a bytecode file in, the initial parsing & evaluation phase has already been completed).

To write a bytecode file from a script:
arturo -c path/to/your/script.art

This will output a path/to/your/script.art.bcode file.

To read and execute a bytecode file:
arturo -x path/to/your/script.art.bcode

Package manager

Although Arturo's philosophy is batteries-included - so you'll most likely need nothing that is not already included - Arturo also comes with a ready-to-use package manager, to make your life even easier.

List available packages

To list all available packages, just type:

arturo -p list

This will show you all the packages you have installed locally.)

List remote packages

If you want to fetch a list of all packages available to download from the official repository, just type:

arturo -p remote

Install a new package

To install a package

arturo -p install grafito

💡 If you do e.g. import 'grafito! from within the REPL or your Arturo script, if the package isn't already installed, it'll automatically be taken care of - so, nothing to worry about! ;-)

Uninstall a package

In order to uninstall a package you have previously, you just have to type:

arturo -p uninstall grafito

Update all packages

If you want to update all of your local packages, there's no reason to uninstall/reinstall anything. Just type:

arturo -p update

And all of your packages will be automatically up-to-date.