âš¡ Quick Start Guide
Get up and running with AetherShell in 5 minutes
Installation
Prerequisites
- Rust 1.70 or later
- Cargo (comes with Rust)
Build from Source
# Clone the repository
git clone https://github.com/nervosys/cli/AetherShell.git
cd AetherShell
# Build release version
cargo build --release
# The binary will be at: target/release/ae
./target/release/ae
Tip: Add AetherShell to your PATH for easy access:
export PATH=$PATH:$PWD/target/release
Your First Commands
Hello World
print("Hello, AetherShell!")
Basic Arithmetic
result = 10 + 20 * 2
print(result) // 50
String Interpolation
name = "World"
print("Hello, ${name}!")
Pipelines (The Power of AetherShell)
Simple Pipeline
// Transform an array
[1, 2, 3, 4, 5]
| map(fn(x) => x * 2)
| print
// Output: [2, 4, 6, 8, 10]
Filter and Reduce
// Sum of even numbers 1-10
range(1, 11)
| where(fn(x) => x % 2 == 0)
| reduce(fn(a, b) => a + b, 0)
| print
// Output: 30
Working with Records
// List files and filter by size
ls(".")
| where(fn(f) => f.size > 1000)
| map(fn(f) => f.name)
| print
Variables and Types
Immutable by Default
// Immutable binding
x = 10
// x = 20 // Error: cannot reassign
// Mutable binding
y := 10
y = 20 // OK
Type Inference
// Types are inferred
nums = [1, 2, 3] // Array of Int
name = "Alice" // String
pi = 3.14 // Float
flag = true // Bool
// Records
person = {
name: "Alice",
age: 30,
active: true
}
Functions
Lambda Functions
// Single parameter
double = fn(x) => x * 2
print(double(5)) // 10
// Multiple parameters
add = fn(a, b) => a + b
print(add(3, 4)) // 7
// Inline in pipelines
[1,2,3] | map(fn(x) => x * x) // [1, 4, 9]
Higher-Order Functions
// Functions that return functions
multiplier = fn(factor) => fn(x) => x * factor
times2 = multiplier(2)
times3 = multiplier(3)
print(times2(5)) // 10
print(times3(5)) // 15
Common Built-in Functions
| Function | Description | Example |
|---|---|---|
print(value) |
Pretty-print a value | print("Hello") |
echo(...values) |
Echo values to stdout | echo "A" "B" |
range(start, end) |
Generate number range | range(1, 10) |
map(array, fn) |
Transform array elements | [1,2,3] | map(fn(x) => x*2) |
where(array, fn) |
Filter array elements | arr | where(fn(x) => x > 5) |
reduce(arr, fn, init) |
Fold array to single value | arr | reduce(fn(a,b) => a+b, 0) |
len(value) |
Get length | len([1,2,3]) |
keys(record) |
Get record keys | keys({a: 1, b: 2}) |
File System Operations
// List directory
files = ls(".")
print(files)
// Read file content
content = cat("README.md")
print(content)
// Current directory
current = pwd()
print(current)
// Find files
results = find(".", "*.rs")
print(results)
String Operations
// Split and join
words = split("hello,world", ",") // ["hello", "world"]
joined = join(words, "-") // "hello-world"
// Transform
upper("hello") // "HELLO"
lower("WORLD") // "world"
trim(" hello ") // "hello"
// Search
contains("hello", "ell") // true
starts_with("hello", "hel") // true
ends_with("hello", "lo") // true
AI Integration (Quick Preview)
Deploy an AI Agent
// Simple agent with goal
result = agent("List all .rs files", "ls", 5)
print(result)
AgenticBinary Protocol
// Encode a message
msg = ab_encode("command", "ping", "hello")
print(msg) // [0, 5, 104, 101, 108, 108, 111]
// Decode the message
decoded = ab_decode(msg)
print(decoded.opcode) // "PING"
print(decoded.payload) // "hello"
Learn More: Check out the AI & Agents section for comprehensive
AI features.
Running Scripts
Execute a Script File
# Create a script file: hello.ae
echo 'print("Hello from script!")' > hello.ae
# Run it
ae hello.ae
REPL Mode
# Start interactive mode
ae
# Now you can type commands interactively
ae> x = 10
ae> y = 20
ae> print(x + y)
30
ae> exit
Next Steps
Common Tasks Cheat Sheet
// Array operations
[1,2,3] | map(fn(x) => x*2) // [2,4,6]
[1,2,3] | where(fn(x) => x>1) // [2,3]
[1,2,3] | reduce(fn(a,b)=>a+b, 0) // 6
reverse([1,2,3]) // [3,2,1]
first([1,2,3]) // 1
last([1,2,3]) // 3
// String manipulation
"hello" | upper() // "HELLO"
split("a,b,c", ",") // ["a","b","c"]
join(["a","b"], "-") // "a-b"
// File operations
ls(".") | where(fn(f) => f.size > 1000)
cat("file.txt") | split("\n") | len
// Math
abs(-5) // 5
min(3, 7) // 3
max(3, 7) // 7
sqrt(16) // 4
pow(2, 3) // 8
// Type checking
type_of(42) // "Int"
type_of("hi") // "Str"
type_of([1,2]) // "Array"