Skip to content

Repository files navigation

ONIX

A shell with its own syntax.

License: MIT Made with C Made with Rust Made with Go Made with Python GitHub stars

No cd. No ls. No |. ONIX replaces every piece of UNIX shell syntax with its own, deliberately non-colliding vocabulary -- enterdir, list, pipe, save >, run -- so a command you type is never ambiguous between "builtin" and "whatever happens to be on $PATH". Typed cd out of habit? ONIX tells you to use enterdir (or run translate cd to find out), instead of guessing.

onix ~/projects ⌥ main ▸ list pipe look ".rs" pipe count
onix ~/projects ⌥ main ▸ createfile notes.txt and view notes.txt
onix ~/projects ⌥ main ▸ run-bg cargo watch
[1] 41213
onix ~/projects ⌥ main ▸ showjobs
[1] running  pgid=41213  cargo watch

Features

  • Its own grammar, not UNIX's. Pipes are the word pipe, redirection is save > / append >> / read <, logic is and/or, external programs need an explicit run. See docs/user-guide.md for the full reference and the reasoning.
  • A real polyglot architecture, each language doing the part it's best at -- see Architecture below and docs/architecture.md for the details, including the flat text protocol the Go parser and C runtime speak instead of JSON.
  • Actual job control: run-bg, showjobs, foreground, background, killjob, process groups, tcsetpgrp -- not a toy.
  • Scripting with real control flow: if/loop/while/function and $VAR interpolation, on top of ordinary Onix command lines. See examples/scripts/.
  • A plugin system in three languages: native (C/Rust, dlopen'd in process) and Python (subprocess) plugins, side by side. See docs/plugin-api.md.
  • Config as code: ~/.onixrc is a Python script that prints the Onix commands to run at startup -- conditionals, environment lookups, computed aliases, whatever you want.
  • Fast: ~2ms process startup on Apple Silicon (target: <100ms), a Rust-implemented builtin dispatch table, and goroutine-parallel parsing for large .onix scripts.
  • Memory-safety where it counts: every builtin lives in Rust behind catch_unwind, so a bug in one command can't take the whole shell down; the small amount of manual C memory management in the process/job layer is covered by tests/leak_check.sh.

Architecture

Go parser  →  flat text AST  →  C runtime (REPL, terminal, jobs, signals)
                                     │              ▲
                                     ▼              │
                              Rust builtins ─────────┘
                             (prompt, history, autocomplete)
                                     │
                                     ▼
                          Python (~/.onixrc, .py plugins)

Full diagram and rationale: docs/architecture.md.

Quick install

git clone https://github.com/butaraul/ONIX-Shell onix && cd onix
make build
./build/onix

See INSTALL.md for prerequisites, a system-wide install, and how to set ONIX as your login shell.

Build from source

Requires Go 1.21+, Rust (stable), a C11 compiler, and Python 3 on your $PATH.

make build     # builds the Go parser lib, Rust builtins lib, and links onix
make test      # cargo test + go test + the shell's own integration suite
make run       # build, then launch it
make install   # install to /usr/local (override with PREFIX=...)
make clean

Usage examples

onix> createfile todo.txt
onix> view todo.txt
onix> list pipe look ".md"
onix> list save > files.txt
onix> set NAME = world
onix> get NAME
onix> alias ll = list-all
onix> ll
onix> run-bg sleep 30
onix> showjobs
onix> translate grep
grep  ->  look
onix> explain pipe
Chains stage output into the next stage's input, like '|' in Unix shells.

Run a script:

onix examples/scripts/greet.onix

Plugins

onix> plugins
onix> plugin load greetc
onix> greetc world

Three complete, working examples (C, Rust, Python) live in examples/plugins/. Full API: docs/plugin-api.md.

Config

cp examples/.onixrc ~/.onixrc

~/.onixrc is a Python script -- see the example for aliases, variables, and platform-conditional setup. reload inside Onix re-runs it.

Contributing

See CONTRIBUTING.md for the bug report / feature request / PR process and coding standards across all four languages.

License

MIT

About

A polyglot shell with custom commands (enterdir, list, view, killfile) and a plugin system.

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages