You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Not** supported (by design, to keep it simple): variables (`$VAR`), subshells, `&&`/`||`, globbing.
152
152
153
153
### Shell vs. Coreutils: Who Does What?
154
154
155
-
It's important to understand that **coreutils only provides individual commands** like `sort`, `cat`, `ls`, etc. Features like `if`/`then`/`else`, `while` loops, `for` loops, variable expansion (`$VAR`), and globbing (`*.txt`) are all **shell features**— they are provided by a shell such as Bash or Zsh, not by coreutils.
155
+
It's important to understand that **coreutils only provides individual commands** like `sort`, `cat`, `ls`, etc. Features like `if`/`then`/`else`, `while` loops, `for` loops, variable expansion (`$VAR`), and globbing (`*.txt`) are all **shell features**- they are provided by a shell such as Bash or Zsh, not by coreutils.
156
156
157
-
Since the playground implements only a minimal shell (pipes, redirections, quoting, and a few builtins), these shell constructs are not available. This isn't a limitation of uutils itself — it's simply because the playground's JavaScript shell is intentionally lightweight and doesn't include a full shell language interpreter.
157
+
Since the playground implements only a minimal shell (pipes, redirections, quoting, and a few builtins), these shell constructs are not available. This isn't a limitation of uutils itself - it's simply because the playground's JavaScript shell is intentionally lightweight and doesn't include a full shell language interpreter.
158
158
159
159
## The Rust Side: Building Coreutils for WebAssembly
160
160
@@ -166,7 +166,7 @@ The uutils coreutils are compiled to **`wasm32-wasip1`** (WebAssembly System Int
This produces a single `uutils.wasm` binary — a **multicall binary** similar to BusyBox, where all 60+ utilities are bundled into one executable.
169
+
This produces a single `uutils.wasm` binary - a **multicall binary** similar to BusyBox, where all 60+ utilities are bundled into one executable.
170
170
171
171
### The `feat_wasm` Feature Gate
172
172
@@ -190,7 +190,7 @@ flowchart LR
190
190
end
191
191
</pre>
192
192
193
-
Utilities are excluded when they depend on OS-level syscalls not available in WASI — for example, `df` needs filesystem stats, `du` needs directory traversal with metadata, and `chown`/`chcon` need permission and SELinux APIs.
193
+
Utilities are excluded when they depend on OS-level syscalls not available in WASI - for example, `df` needs filesystem stats, `du` needs directory traversal with metadata, and `chown`/`chcon` need permission and SELinux APIs.
194
194
195
195
### Multicall Binary: How Command Dispatch Works
196
196
@@ -215,8 +215,8 @@ type UtilityMap<T> = phf::OrderedMap<
215
215
```
216
216
217
217
Each entry maps a utility name (e.g. `"sort"`) to a pair of functions:
218
-
-**`uumain`**— the utility's entry point, taking argument iterators and returning an exit code
219
-
-**`uu_app`**— returns the `clap::Command` definition for argument parsing and help
218
+
-**`uumain`**- the utility's entry point, taking argument iterators and returning an exit code
219
+
-**`uu_app`**- returns the `clap::Command` definition for argument parsing and help
220
220
221
221
At **runtime**, the multicall binary reads `argv` to determine which utility to invoke. In the browser, the JavaScript shell calls the WASM binary as `["coreutils", "sort", "-rn"]`, so `argv[1]` becomes the dispatch key.
These stubs mean the utilities gracefully degrade rather than crash —`tail -f` simply won't follow, `cp` won't create symlinks, and `ls` won't show hostname information.
241
+
These stubs mean the utilities gracefully degrade rather than crash -`tail -f` simply won't follow, `cp` won't create symlinks, and `ls` won't show hostname information.
242
242
243
243
### Localization: Embedding All Translations
244
244
@@ -258,5 +258,5 @@ flowchart TB
258
258
end
259
259
</pre>
260
260
261
-
On native platforms, `uucore`'s build script embeds only the [Fluent](https://projectfluent.org/) (`.ftl`) translation files matching the user's `LANG` environment variable, to keep the binary small. For WASI builds, **all locale files are embedded**, because the target locale isn't known at compile time — the playground user can switch languages at runtime via the locale dropdown or the `locale` command.
261
+
On native platforms, `uucore`'s build script embeds only the [Fluent](https://projectfluent.org/) (`.ftl`) translation files matching the user's `LANG` environment variable, to keep the binary small. For WASI builds, **all locale files are embedded**, because the target locale isn't known at compile time - the playground user can switch languages at runtime via the locale dropdown or the `locale` command.
Copy file name to clipboardExpand all lines: content/playground.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title = "Playground"
3
3
template = "page.html"
4
4
+++
5
5
6
-
<p>Try <ahref="https://github.com/uutils/coreutils">uutils coreutils</a> directly in your browser! This interactive terminal runs Rust coreutils via WebAssembly — no installation needed.</p>
6
+
<p>Try <ahref="https://github.com/uutils/coreutils">uutils coreutils</a> directly in your browser! This interactive terminal runs Rust coreutils via WebAssembly - no installation needed.</p>
You can pre-fill the terminal with a command using the `?cmd=` URL parameter. The command runs automatically when the page loads — great for sharing examples or linking from documentation.
78
+
You can pre-fill the terminal with a command using the `?cmd=` URL parameter. The command runs automatically when the page loads - great for sharing examples or linking from documentation.
79
79
80
80
**Examples:**
81
81
82
-
-[`?cmd=date`](/playground?cmd=date)— show the current date
0 commit comments