feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules

Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
This commit is contained in:
2026-01-24 22:40:22 +00:00
parent 0a65272f80
commit 5a4054ec66
105 changed files with 23275 additions and 94 deletions
+202
View File
@@ -0,0 +1,202 @@
<!DOCTYPE html>
<!-- retoor <retoor@molodetz.nl> -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Getting Started - Wren-CLI Manual</title>
<link rel="stylesheet" href="../css/style.css">
</head>
<body>
<button class="mobile-menu-toggle">Menu</button>
<div class="container">
<aside class="sidebar">
<div class="sidebar-header">
<h1><a href="../index.html">Wren-CLI</a></h1>
<div class="version">v0.4.0</div>
</div>
<nav class="sidebar-nav">
<div class="section">
<span class="section-title">Getting Started</span>
<ul>
<li><a href="index.html" class="active">Overview</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="first-script.html">First Script</a></li>
<li><a href="repl.html">Using the REPL</a></li>
</ul>
</div>
<div class="section">
<span class="section-title">Language</span>
<ul>
<li><a href="../language/index.html">Syntax Overview</a></li>
<li><a href="../language/classes.html">Classes</a></li>
<li><a href="../language/methods.html">Methods</a></li>
<li><a href="../language/control-flow.html">Control Flow</a></li>
<li><a href="../language/fibers.html">Fibers</a></li>
<li><a href="../language/modules.html">Modules</a></li>
</ul>
</div>
<div class="section">
<span class="section-title">API Reference</span>
<ul>
<li><a href="../api/index.html">Overview</a></li>
<li><a href="../api/http.html">http</a></li>
<li><a href="../api/websocket.html">websocket</a></li>
<li><a href="../api/tls.html">tls</a></li>
<li><a href="../api/net.html">net</a></li>
<li><a href="../api/dns.html">dns</a></li>
<li><a href="../api/json.html">json</a></li>
<li><a href="../api/base64.html">base64</a></li>
<li><a href="../api/regex.html">regex</a></li>
<li><a href="../api/jinja.html">jinja</a></li>
<li><a href="../api/crypto.html">crypto</a></li>
<li><a href="../api/os.html">os</a></li>
<li><a href="../api/env.html">env</a></li>
<li><a href="../api/signal.html">signal</a></li>
<li><a href="../api/subprocess.html">subprocess</a></li>
<li><a href="../api/sqlite.html">sqlite</a></li>
<li><a href="../api/datetime.html">datetime</a></li>
<li><a href="../api/timer.html">timer</a></li>
<li><a href="../api/io.html">io</a></li>
<li><a href="../api/scheduler.html">scheduler</a></li>
<li><a href="../api/math.html">math</a></li>
</ul>
</div>
<div class="section">
<span class="section-title">Tutorials</span>
<ul>
<li><a href="../tutorials/index.html">Tutorial List</a></li>
<li><a href="../tutorials/http-client.html">HTTP Client</a></li>
<li><a href="../tutorials/websocket-chat.html">WebSocket Chat</a></li>
<li><a href="../tutorials/database-app.html">Database App</a></li>
<li><a href="../tutorials/template-rendering.html">Templates</a></li>
<li><a href="../tutorials/cli-tool.html">CLI Tool</a></li>
</ul>
</div>
<div class="section">
<span class="section-title">How-To Guides</span>
<ul>
<li><a href="../howto/index.html">How-To List</a></li>
<li><a href="../howto/http-requests.html">HTTP Requests</a></li>
<li><a href="../howto/json-parsing.html">JSON Parsing</a></li>
<li><a href="../howto/regex-patterns.html">Regex Patterns</a></li>
<li><a href="../howto/file-operations.html">File Operations</a></li>
<li><a href="../howto/async-operations.html">Async Operations</a></li>
<li><a href="../howto/error-handling.html">Error Handling</a></li>
</ul>
</div>
</nav>
</aside>
<main class="content">
<nav class="breadcrumb">
<a href="../index.html">Home</a>
<span class="separator">/</span>
<span>Getting Started</span>
</nav>
<article>
<h1>Getting Started</h1>
<p>Welcome to Wren-CLI, a command-line interface for the Wren programming language extended with powerful modules for networking, file I/O, databases, and more.</p>
<div class="toc">
<h4>In This Section</h4>
<ul>
<li><a href="installation.html">Installation</a> - Build from source on Linux, macOS, or FreeBSD</li>
<li><a href="first-script.html">First Script</a> - Write and run your first Wren program</li>
<li><a href="repl.html">Using the REPL</a> - Interactive experimentation</li>
</ul>
</div>
<h2>What is Wren?</h2>
<p>Wren is a small, fast, class-based scripting language. It has a familiar syntax, first-class functions, and a fiber-based concurrency model. Wren-CLI extends the core language with modules for:</p>
<ul>
<li>HTTP and WebSocket networking</li>
<li>File and directory operations</li>
<li>SQLite database access</li>
<li>JSON and regex processing</li>
<li>Template rendering (Jinja2-compatible)</li>
<li>Cryptographic operations</li>
<li>Process and signal handling</li>
</ul>
<h2>Quick Start</h2>
<p>If you want to dive right in, here is the fastest path to running your first script:</p>
<h3>1. Build</h3>
<pre><code>git clone https://github.com/wren-lang/wren-cli.git
cd wren-cli
cd projects/make && make</code></pre>
<h3>2. Create a Script</h3>
<p>Create a file named <code>hello.wren</code>:</p>
<pre><code>System.print("Hello, Wren!")</code></pre>
<h3>3. Run</h3>
<pre><code>bin/wren_cli hello.wren</code></pre>
<div class="example-output">Hello, Wren!</div>
<h2>Key Concepts</h2>
<p>Before diving deeper, understand these fundamental Wren concepts:</p>
<h3>Everything is an Object</h3>
<p>In Wren, everything is an object, including numbers, strings, and functions. Every object is an instance of a class.</p>
<pre><code>var name = "Wren"
System.print(name.count) // 4
System.print(name.bytes[0]) // 87 (ASCII for 'W')</code></pre>
<h3>Fibers for Concurrency</h3>
<p>Wren uses fibers (cooperative threads) for concurrency. The scheduler module manages async operations.</p>
<pre><code>import "timer" for Timer
Timer.sleep(1000) // Pauses for 1 second
System.print("Done waiting")</code></pre>
<h3>Module System</h3>
<p>Functionality is organized into modules that you import as needed:</p>
<pre><code>import "http" for Http
import "json" for Json
var response = Http.get("https://api.example.com/data")
var data = Json.parse(response.body)</code></pre>
<h2>System Requirements</h2>
<table>
<tr>
<th>Platform</th>
<th>Requirements</th>
</tr>
<tr>
<td>Linux</td>
<td>GCC, Make, OpenSSL development libraries</td>
</tr>
<tr>
<td>macOS</td>
<td>Xcode Command Line Tools, OpenSSL (via Homebrew)</td>
</tr>
<tr>
<td>FreeBSD</td>
<td>GCC or Clang, gmake, OpenSSL</td>
</tr>
</table>
<h2>Next Steps</h2>
<p>Continue with the following sections to learn more:</p>
<ul>
<li><a href="installation.html">Installation</a> - Detailed build instructions for all platforms</li>
<li><a href="first-script.html">First Script</a> - A more detailed walkthrough of your first program</li>
<li><a href="../language/index.html">Language Reference</a> - Learn the Wren language syntax</li>
<li><a href="../api/index.html">API Reference</a> - Explore all available modules</li>
</ul>
</article>
<footer class="page-footer">
<a href="../index.html" class="prev">Home</a>
<a href="installation.html" class="next">Installation</a>
</footer>
</main>
</div>
<script src="../js/main.js"></script>
</body>
</html>