CLI Usage
The Rui command-line interface (CLI) allows you to run Rui programs and access various tools. This guide covers all the available commands and options.
Basic Usage
The basic syntax for running Rui programs is:
rui <filename>Command Line Options
Version Information
Check the current version of Rui:
rui --version\nrui -vFile Extensions
Rui programs should use the .rui file extension:
# Good
rui program.rui
rui hello.rui
rui calculator.rui
# Also works (but not recommended)
rui program
rui helloError Handling
When Rui encounters an error, it will display helpful error messages:
rui nonexistent.rui\n# Error: File 'nonexistent.rui' not found\n\nrui syntax_error.rui\n# Error: Syntax error on line 3: unexpected tokenExample: Hello World
Create a file called hello.rui:
write("Hello, World!")Run it:
rui hello.ruiOutput:
Hello, World!Example: Interactive Program
Create a file called interactive.rui:
suppose name = "Alice"
suppose age = 25
write("Name: " + name)
write("Age: " + age)
write("Next year: " + (age + 1))Run it:
rui interactive.ruiOutput:
Name: Alice
Age: 25
Next year: 26Example: Calculator
Create a file called calculator.rui:
define add(a, b) {
return a + b
}
define multiply(a, b) {
return a * b
}
suppose result1 = add(5, 3)
suppose result2 = multiply(4, 7)
write("5 + 3 = " + result1)
write("4 * 7 = " + result2)Run it:
rui calculator.ruiOutput:
5 + 3 = 8
4 * 7 = 28Getting Help
If you encounter issues:
- Check the Installation guide
- Update Rui to latest version
npm install -g rui-lang - Verify your Rui syntax
- Use
rui --helpfor command options - Check the VS Code Integration for development tools
Next Steps
Now that you understand the CLI, learn about VS Code Integration to enhance your development experience.