{"id":31867948,"url":"https://github.com/Esubaalew/run","last_synced_at":"2025-10-12T20:04:51.723Z","repository":{"id":317529035,"uuid":"1066975996","full_name":"Esubaalew/run","owner":"Esubaalew","description":"Universal multi-language runner and smart REPL written in Rust.","archived":false,"fork":false,"pushed_at":"2025-10-10T12:43:49.000Z","size":127,"stargazers_count":707,"open_issues_count":1,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-11T00:58:12.075Z","etag":null,"topics":["cli","crate","open-source","repl","rust"],"latest_commit_sha":null,"homepage":"https://run.esubalew.et","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Esubaalew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-30T08:03:00.000Z","updated_at":"2025-10-11T00:55:47.000Z","dependencies_parsed_at":"2025-10-06T04:31:07.621Z","dependency_job_id":null,"html_url":"https://github.com/Esubaalew/run","commit_stats":null,"previous_names":["esubaalew/run"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Esubaalew/run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esubaalew%2Frun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esubaalew%2Frun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esubaalew%2Frun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esubaalew%2Frun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Esubaalew","download_url":"https://codeload.github.com/Esubaalew/run/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esubaalew%2Frun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009935,"owners_count":26084668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","crate","open-source","repl","rust"],"created_at":"2025-10-12T20:01:52.489Z","updated_at":"2025-10-12T20:04:51.706Z","avatar_url":"https://github.com/Esubaalew.png","language":"Rust","readme":"\u003ch1 align=\"center\"\u003erun\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cstrong\u003ePolyglot command runner \u0026 smart REPL that lets you script, compile, and iterate in 25+ languages without touching another CLI.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003c!-- Release --\u003e\n  \u003ca href=\"https://github.com/Esubaalew/run/releases/latest\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/Esubaalew/run?style=flat-square\u0026color=orange\u0026logo=github\" alt=\"Latest release\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Release status --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/release-passing-brightgreen?style=flat-square\" alt=\"Release passing\" /\u003e\n\n  \u003c!-- Docs --\u003e\n  \u003ca href=\"https://docs.rs/run-kit\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-passing-brightgreen?style=flat-square\u0026logo=rust\" alt=\"Docs passing\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Crates.io --\u003e\n  \u003ca href=\"https://crates.io/crates/run-kit\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/run-kit.svg?style=flat-square\u0026logo=rust\u0026color=red\" alt=\"crates.io\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Downloads --\u003e\n  \u003ca href=\"https://github.com/Esubaalew/run/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/downloads/Esubaalew/run/total?style=flat-square\u0026color=blue\" alt=\"Downloads\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Stars --\u003e\n  \u003ca href=\"https://github.com/Esubaalew/run/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/Esubaalew/run?style=flat-square\u0026color=yellow\" alt=\"GitHub stars\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Platforms --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey?style=flat-square\" alt=\"Platform support\" /\u003e\n\n  \u003c!-- License --\u003e\n  \u003ca href=\"LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://run.esubalew.et/\"\u003eWebsite\u003c/a\u003e\n\t•\n\t\u003ca href=\"https://run.esubalew.et/docs/overview\"\u003eDocs Overview\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Built in Rust for developers who live in multiple runtimes. `run` gives you a consistent CLI, persistent REPLs, and batteries-included examples for your favorite languages.\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTable of contents\u003c/strong\u003e\u003c/summary\u003e\n\n- [Website and Docs](#website-and-docs)\n- [Overview](#overview---universal-multi-language-runner)\n  - [What is run?](#what-is-run)\n  - [Who is this for?](#who-is-this-for)\n  - [Why was run created?](#why-was-run-created)\n  - [Why Rust?](#why-rust)\n- [Highlights](#-highlights)\n- [Quickstart](#-quickstart)\n- [Installation](#-installation)\n- [How it works](#-how-it-works)\n- [Supported languages](#-supported-languages)\n  - [Complete Language Aliases Reference](#complete-language-aliases-reference)\n- [Command Variations - Flexible Syntax](#command-variations---flexible-syntax)\n- [Command-Line Flags Reference](#command-line-flags-reference)\n- [⚠️ When to Use --lang (Important!)](#️-when-to-use---lang-important)\n- [Main Function Flexibility](#main-function-flexibility)\n- [Examples](#-examples)\n- [REPL](#-repl)\n  - [Interactive REPL - Line by Line or Paste All](#interactive-repl---line-by-line-or-paste-all)\n  - [Variable Persistence \u0026 Language Switching](#variable-persistence--language-switching)\n  - [REPL Commands](#repl-commands)\n- [Stdin Piping Examples](#stdin-piping-examples)\n- [Language-Specific Notes](#language-specific-notes)\n- [📄 License](#-license)\n\n\u003c/details\u003e\n\n---\n\n# Website and Docs\n\nThe official website and full documentation are available here:\n\n- Website: https://run.esubalew.et/\n- Docs Overview: https://run.esubalew.et/docs/overview\n\nUse these links to explore features, language guides, and detailed examples.\n\n---\n\n# Overview - Universal Multi-Language Runner\n\nA powerful command-line tool for executing code in 25 programming languages\n\n## What is run?\n\nrun is a universal multi-language runner and smart REPL (Read-Eval-Print Loop) written in Rust. It provides a unified interface for executing code across 25 programming languages without the hassle of managing multiple compilers, interpreters, or build tools.\n\nWhether you're a beginner learning your first programming language or an experienced polyglot developer, run streamlines your workflow by providing consistent commands and behavior across all supported languages.\n\n## Who is this for?\n\n• Beginners: Learn programming without worrying about complex setup procedures. Just install run and start coding in any language.\n\n• Students: Quickly test code snippets and experiment with different programming paradigms across multiple languages.\n\n• Developers: Prototype ideas rapidly, test algorithms, and switch between languages seamlessly without context switching.\n\n• DevOps Engineers: Write and test automation scripts in various languages from a single tool.\n\n• Educators: Teach programming concepts across multiple languages with a consistent interface.\n\n## Why was run created?\n\nTraditional development workflows require installing and configuring separate tools for each programming language. This creates several problems:\n\n• Time-consuming setup: Installing compilers, interpreters, package managers, and configuring environments for each language.\n\n• Inconsistent interfaces: Each language has different commands and flags for compilation and execution.\n\n• Cognitive overhead: Remembering different commands and workflows for each language.\n\n• Barrier to entry: Beginners struggle with setup before writing their first line of code.\n\nrun solves these problems by providing a single, unified interface that handles all the complexity behind the scenes. You focus on writing code, and run takes care of the rest.\n\n## Why Rust?\n\nrun is built with Rust for several compelling reasons:\n\n• Performance: Rust's zero-cost abstractions and efficient memory management ensure run starts instantly and executes with minimal overhead.\n\n• Reliability: Rust's strong type system and ownership model prevent common bugs like null pointer dereferences and data races, making run stable and crash-resistant.\n\n• Cross-platform: Rust compiles to native code for Windows, macOS, and Linux, providing consistent behavior across all platforms.\n\n• Memory safety: No garbage collector means predictable performance without unexpected pauses.\n\n• Modern tooling: Cargo (Rust's package manager) makes building and distributing run straightforward.\n\n• Future-proof: Rust's growing ecosystem and industry adoption ensure long-term maintainability.\n\n---\n\n## Quickstart\n\n```bash\n# Show build metadata for the current binary\nrun --version\n\n# Execute a snippet explicitly\nrun --lang python --code \"print('hello, polyglot world!')\"\n\n# Let run detect language from the file extension\nrun examples/go/hello/main.go\n\n# Drop into the interactive REPL (type :help inside)\nrun\n\n# Pipe stdin (here: JSON) into Node.js\necho '{\"name\":\"Ada\"}' | run js --code \"const data = JSON.parse(require('fs').readFileSync(0, 'utf8')); console.log(`hi ${data.name}`)\"\n\n# Pipe stdin into Python\necho \"Hello from stdin\" | run python --code \"import sys; print(sys.stdin.read().strip().upper())\"\n\n# Pipe stdin into Go\necho \"world\" | run go --code 'import \"fmt\"; import \"bufio\"; import \"os\"; scanner := bufio.NewScanner(os.Stdin); scanner.Scan(); fmt.Printf(\"Hello, %s!\\n\", scanner.Text())'\n```\n\n---\n\n## Installation\n\nAll release assets are published on the [GitHub Releases](https://github.com/Esubaalew/run/releases) page, including macOS builds for both Apple Silicon (arm64) and Intel (x86_64). Pick the method that fits your platform:\n\nInstalling run is straightforward. Choose the method that works best for your system:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCargo (Rust)\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\ncargo install run-kit\n```\n\n\u003e Installs the `run` binary from the [`run-kit`](https://crates.io/crates/run-kit) crate. Updating? Run `cargo install run-kit --force`.\n\n```bash\n# Or build from source\ngit clone https://github.com/Esubaalew/run.git\ncd run\ncargo install --path .\n```\n\n\u003e This builds the run binary using your active Rust toolchain. The project targets Rust 1.70 or newer.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eHomebrew (macOS)\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nbrew install --formula https://github.com/Esubaalew/run/releases/latest/download/homebrew-run.rb\n```\n\n\u003e This formula is published as a standalone file on each release; it isn’t part of the default Homebrew taps. Installing by name (`brew install homebrew-run`) will fail—always point Homebrew to the release URL above (or download the file and run `brew install ./homebrew-run.rb`).\n\nOnce the latest release artifacts are published, Homebrew automatically selects the correct macOS binary for your CPU (Intel or Apple Silicon) based on this formula.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDebian / Ubuntu\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nARCH=${ARCH:-amd64}\nDEB_FILE=$(curl -s https://api.github.com/repos/Esubaalew/run/releases/latest \\\n  | grep -oE \"run_[0-9.]+_${ARCH}\\\\.deb\" | head -n 1)\ncurl -LO \"https://github.com/Esubaalew/run/releases/latest/download/${DEB_FILE}\"\ncurl -LO \"https://github.com/Esubaalew/run/releases/latest/download/${DEB_FILE}.sha256\"\nsha256sum --check \"${DEB_FILE}.sha256\"\nsudo apt install \"./${DEB_FILE}\"\n```\n\n\u003e **Tip:** If you prefer to select the files manually, open the [latest release page](https://github.com/Esubaalew/run/releases/latest), note the `.deb` and matching `.sha256` asset names for your architecture (e.g., `amd64`, `arm64`), and substitute them for `${DEB_FILE}` above.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWindows (Scoop)\u003c/strong\u003e\u003c/summary\u003e\n\n```powershell\nscoop install https://github.com/Esubaalew/run/releases/latest/download/run-scoop.json\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eInstall script (macOS / Linux)\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\ncurl -fsSLO https://raw.githubusercontent.com/Esubaalew/run/master/scripts/install.sh\nchmod +x install.sh\n./install.sh --add-path           # optional: append ~/.local/bin to PATH\n```\n\nPass `--version v0.2.0`, `--prefix /usr/local/bin`, or `--repo yourname/run` to customize the install.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDownload the archive directly\u003c/strong\u003e\u003c/summary\u003e\n\n1. Grab the `tar.gz` (macOS/Linux) or `zip` (Windows) from the latest release.\n2. Extract it and copy `run` / `run.exe` onto your `PATH`.\n3. Optionally execute the bundled `install.sh` to handle the copy for you.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuild from source\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\ncargo install run-kit\n```\n\nThe project targets Rust 1.70+. Installing from crates.io gives you the same `run` binary that CI publishes; use `--force` when upgrading to a newer release.\n\n\u003c/details\u003e\n\nVerify installation:\n\n```bash\n# Verify installation\nrun --version\n```\n\nOutput:\n\n```\nrun 0.2.0\n```\n\n---\n\n## How it works\n\n`run` shells out to real toolchains under the hood. Each `LanguageEngine` implements a small trait that knows how to:\n\n1. Detect whether the toolchain is available (e.g. `python3`, `go`, `rustc`).\n2. Prepare a temporary workspace (compilation for compiled languages, transient scripts for interpreters).\n3. Execute snippets, files, or stdin streams and surface stdout/stderr consistently.\n4. Manage session state for the interactive REPL (persistent modules, stateful scripts, or regenerated translation units).\n\nThis architecture keeps the core lightweight while making it easy to add new runtimes or swap implementations.\n\n---\n\n## Supported languages\n\n`run` supports 25+ languages:\n\nrun supports 25 programming languages out of the box, covering a wide range of paradigms and use cases:\n\n```\n# Scripting Languages\nPython, JavaScript, Ruby, Bash, Lua, Perl, PHP\n\n# Compiled Languages\nRust, Go, C, C++, Java, C#, Swift, Kotlin, Crystal, Zig, Nim\n\n# Typed \u0026 Functional Languages\nTypeScript, Haskell, Elixir, Julia\n\n# Specialized Languages\nR (Statistical computing)\nDart (Mobile development)\n```\n\n| Category                  | Languages \u0026 aliases                                                                                                                                                                                                     | Toolchain expectations                  |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |\n| **Scripting \u0026 shells**    | Bash (`bash`), Python (`py`, `python`), Ruby (`rb`, `ruby`), PHP (`php`), Perl (`perl`), Groovy (`groovy`, `grv`), Lua (`lua`), R (`r`), Elixir (`ex`, `elixir`)                                                        | Matching interpreter on `PATH`          |\n| **Web \u0026 typed scripting** | JavaScript (`js`, `node`), TypeScript (`ts`, `deno`), Dart (`dart`), Kotlin (`kt`, `kotlin`)                                                                                                                            | `node`, `deno`, `dart`, `kotlinc` + JRE |\n| **Systems \u0026 compiled**    | C (`c`), C++ (`cpp`, `cxx`), Rust (`rs`, `rust`), Go (`go`), Swift (`swift`), Zig (`zig`), Nim (`nim`), Haskell (`hs`, `haskell`), Crystal (`cr`, `crystal`), C# (`cs`, `csharp`), Java (`java`), Julia (`jl`, `julia`) | Respective compiler / toolchain         |\n\n### Categorization notes\n\nThe categories above are usage-based to match how you’ll likely run code with `run` rather than strict language taxonomies. Examples:\n\n- Kotlin can target the JVM, Native, or JavaScript. If you’re using Kotlin/JS, it behaves closer to the “Web \u0026 typed scripting” workflow, while Kotlin/JVM fits “Systems \u0026 compiled” (with a JRE).\n- Swift is listed under “Systems \u0026 compiled” because `swiftc` produces native binaries; however, you can still use it interactively via `run` for scripting-like workflows.\n- TypeScript typically runs via Node or Deno at runtime (transpiled), which is why it appears under “Web \u0026 typed scripting.”\n\nThese groupings optimize for how commands are invoked and which toolchains `run` detects and orchestrates.\n\n### Complete Language Aliases Reference\n\nEvery language in `run` has multiple aliases for convenience. Use whichever feels most natural:\n\n| **Alias** | **Description** | **Badge** |\n|------------|----------------|------------|\n| `python, py, py3, python3` | Python programming language | ![Python](https://img.shields.io/badge/Python-3776AB?logo=python\u0026logoColor=white) |\n| `javascript, js, node, nodejs` | JavaScript (Node.js runtime) | ![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript\u0026logoColor=black) |\n| `typescript, ts, ts-node, deno` | TypeScript with type checking | ![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript\u0026logoColor=white) |\n| `rust, rs` | Rust systems programming language | ![Rust](https://img.shields.io/badge/Rust-000000?logo=rust\u0026logoColor=white) |\n| `go, golang` | Go programming language | ![Go](https://img.shields.io/badge/Go-00ADD8?logo=go\u0026logoColor=white) |\n| `c, gcc, clang` | C programming language | ![C](https://img.shields.io/badge/C-A8B9CC?logo=c\u0026logoColor=black) |\n| `cpp, c++, g++` | C++ programming language | ![C++](https://img.shields.io/badge/C++-00599C?logo=cplusplus\u0026logoColor=white) |\n| `java` | Java programming language | ![Java](https://img.shields.io/badge/Java-007396?logo=java\u0026logoColor=white) |\n| `csharp, cs, dotnet` | C# (.NET) | ![C#](https://img.shields.io/badge/C%23-512BD4?logo=dotnet\u0026logoColor=white) |\n| `ruby, rb, irb` | Ruby programming language | ![Ruby](https://img.shields.io/badge/Ruby-CC342D?logo=ruby\u0026logoColor=white) |\n| `bash, sh, shell, zsh` | Bash shell scripting | ![Bash](https://img.shields.io/badge/Bash-4EAA25?logo=gnubash\u0026logoColor=white) |\n| `lua, luajit` | Lua scripting language | ![Lua](https://img.shields.io/badge/Lua-2C2D72?logo=lua\u0026logoColor=white) |\n| `perl, pl` | Perl programming language | ![Perl](https://img.shields.io/badge/Perl-39457E?logo=perl\u0026logoColor=white) |\n| `groovy, grv, groovysh` | Groovy on the JVM | ![Groovy](https://img.shields.io/badge/Groovy-4298B8?logo=apachegroovy\u0026logoColor=white) |\n| `php, php-cli` | PHP scripting language | ![PHP](https://img.shields.io/badge/PHP-777BB4?logo=php\u0026logoColor=white) |\n| `haskell, hs, ghci` | Haskell functional language | ![Haskell](https://img.shields.io/badge/Haskell-5D4F85?logo=haskell\u0026logoColor=white) |\n| `elixir, ex, exs, iex` | Elixir functional language | ![Elixir](https://img.shields.io/badge/Elixir-4B275F?logo=elixir\u0026logoColor=white) |\n| `julia, jl` | Julia scientific computing | ![Julia](https://img.shields.io/badge/Julia-9558B2?logo=julia\u0026logoColor=white) |\n| `dart, dartlang, flutter` | Dart language (Flutter) | ![Dart](https://img.shields.io/badge/Dart-0175C2?logo=dart\u0026logoColor=white) |\n| `swift, swiftlang` | Swift programming language | ![Swift](https://img.shields.io/badge/Swift-FA7343?logo=swift\u0026logoColor=white) |\n| `kotlin, kt, kts` | Kotlin (JVM/Native) | ![Kotlin](https://img.shields.io/badge/Kotlin-7F52FF?logo=kotlin\u0026logoColor=white) |\n| `r, rscript, cran` | R statistical computing | ![R](https://img.shields.io/badge/R-276DC3?logo=r\u0026logoColor=white) |\n| `crystal, cr, crystal-lang` | Crystal language | ![Crystal](https://img.shields.io/badge/Crystal-000000?logo=crystal\u0026logoColor=white) |\n| `zig, ziglang` | Zig systems language | ![Zig](https://img.shields.io/badge/Zig-F7A41D?logo=zig\u0026logoColor=black) |\n| `nim, nimlang` | Nim programming language | ![Nim](https://img.shields.io/badge/Nim-FFE953?logo=nim\u0026logoColor=black) |\n\n---\n\n## Command Variations - Flexible Syntax\n\nrun supports multiple command formats to fit your workflow. You can be explicit with --lang or let run auto-detect the language:\n\n1. Full syntax with --lang and --code\n\n```bash\nrun --lang rust --code \"fn main() { println!(\\\"hello from rust\\\"); }\"\n```\n\nOutput:\n\n```\nhello from rust\n```\n\n2. Shorthand flags (-l for --lang, -c for --code)\n\n```bash\nrun -l rust -c \"fn main() { println!(\\\"hello from rust\\\"); }\"\n```\n\n3. Omit --code flag (auto-detected)\n\n```bash\nrun --code \"fn main() { println!(\\\"hello from rust\\\"); }\"\n```\n\nOutput:\n\n```\nhello from rust\n```\n\n4. Shorthand - just the code\n\n```bash\nrun \"fn main() { println!(\\\"hello from rust\\\"); }\"\n```\n\nOutput:\n\n```\nhello from rust\n```\n\n5. Language first, then code\n\n```bash\nrun rust \"fn main() { println!(\\\"hello from rust\\\"); }\"\n```\n\nOutput:\n\n```\nhello from rust\n```\n\n---\n\n## Command-Line Flags Reference\n\nrun provides both long-form and short-form flags for convenience:\n\n```bash\n# Language specification\n--lang, -l          Specify the programming language\nrun --lang python \"print('hello')\"\nrun -l python \"print('hello')\"\n\n# Code input\n--code, -c          Provide code as a string\nrun --code \"print('hello')\"\nrun -c \"print('hello')\"\n\n# Combined usage\nrun -l python -c \"print('hello')\"\nrun --lang python --code \"print('hello')\"\n```\n\n---\n\n## ⚠️ When to Use --lang (Important!)\n\nWhile run can auto-detect languages, ambiguous syntax can cause confusion. For example, print('hello') looks similar in Python, Ruby, Lua, and other languages. Always use --lang for correctness when the syntax is ambiguous or when you need deterministic behavior.\n\n```bash\n# ❌ Ambiguous - may choose wrong language\nrun \"print('hello')\"\n```\n\nOutput:\n\n```\nhello  # But which language was used?\n```\n\n```bash\n# ✅ Explicit - always correct\nrun --lang python \"print('hello')\"\n```\n\nOutput:\n\n```\nhello  # Guaranteed to use Python\n```\n\nRECOMMENDATION: Always use --lang for correctness when:\n\n• The syntax is ambiguous across multiple languages\n\n• You want to ensure the exact language is used\n\n• You're writing scripts or automation that must be deterministic\n\n---\n\n## Main Function Flexibility\n\nFor compiled languages (Rust, Go, C, C++, Java, etc.), run is smart about main functions:\n\n• Write complete programs with main functions\n\n• Write code without main functions (run wraps it automatically)\n\n• Both approaches work in REPL mode and inline execution\n\nGo Example - With main function\n\n```bash\n$ run go\nrun universal REPL. Type :help for commands.\n\ngo\u003e\u003e\u003e package main\nimport \"fmt\"\nfunc main() {\n    fmt.Println(\"Hello, world!\")\n}\nHello, world!\n```\n\nGo Example - Without main function\n\n```\ngo\u003e\u003e\u003e fmt.Println(\"Hello, world!\")\nHello, world!\n```\n\n---\n\n## Examples\n\nReal programs live under the [`examples/`](examples) tree—each language has a `hello` and a `progress` scenario. The headers document expected output so you can diff your toolchain.\n\n```bash\nrun examples/rust/hello.rs\nrun examples/typescript/progress.ts\nrun examples/python/counter.py\n```\n\n---\n\n## REPL\n\nBeing inside REPL we can use the ff commands\n\nThe REPL supports several built-in commands for managing your session:\n\n| Command                    | Purpose                                      |\n| -------------------------- | -------------------------------------------- |\n| `:help`                    | List available meta commands                 |\n| `:languages`               | Show detected engines and status             |\n| `:lang \u003cid\u003e` or `:\u003calias\u003e` | Switch the active language (`:py`, `:go`, …) |\n| `:detect on/off/toggle`    | Control snippet language auto-detection      |\n| `:load path/to/file`       | Execute a file inside the current session    |\n| `:reset`                   | Clear the accumulated session state          |\n| `:exit` / `:quit`          | Leave the REPL                               |\n\n| Alias                 | Description                             |\n| --------------------- | --------------------------------------- |\n| `:help`               | Show available REPL commands            |\n| `:quit or :q`         | Exit the REPL                           |\n| `:clear or :c`        | Clear the screen                        |\n| `:reset`              | Reset the session (clear all variables) |\n| `:lang \u003clanguage\u003e`    | Switch to a different language          |\n| `:py, :js, :go, etc.` | Quick language switch shortcuts         |\n\n### Interactive REPL - Line by Line or Paste All\n\nThe REPL mode is incredibly flexible. You can:\n\n• Type code line by line interactively\n\n• Paste entire programs at once\n\n• Mix both approaches in the same session\n\nThis works for ALL supported languages!\n\nPython Example - Paste entire program\n\n```bash\n$ run python\npython\u003e\u003e\u003e def fibonacci(n):\n    if n \u003c= 1:\n        return n\n    return fibonacci(n-1) + fibonacci(n-2)\n\nfor i in range(10):\n    print(f\"F({i}) = {fibonacci(i)}\")\nF(0) = 0\nF(1) = 1\nF(2) = 1\nF(3) = 2\nF(4) = 3\nF(5) = 5\nF(6) = 8\nF(7) = 13\nF(8) = 21\nF(9) = 34\n```\n\nPython Example - Line by line\n\n```\npython\u003e\u003e\u003e x = 10\npython\u003e\u003e\u003e y = 20\npython\u003e\u003e\u003e print(x + y)\n30\n```\n\n\u003e **Tip:** The exact file names follow the pattern `run_\u003cversion\u003e_\u003carch\u003e.deb`. If you prefer to choose manually, visit the [latest release page](https://github.com/Esubaalew/run/releases/latest), note the `.deb` and matching `.sha256` asset names for your architecture (e.g. `amd64`, `arm64`), and substitute them for `${DEB_FILE}` above.\n\nIn REPL mode, variables persist across commands within the same language session. You can also switch languages on the fly using :lang commands.\n\nWhen you switch languages, variables from the previous language do NOT carry over (each language has its own isolated session).\n\nVariable Persistence Example\n\n```\n$ run go\ngo\u003e\u003e\u003e x := 10\ngo\u003e\u003e\u003e x\n10\n\ngo\u003e\u003e\u003e :c\nswitched to c\n\nc\u003e\u003e\u003e int x = 10;\nc\u003e\u003e\u003e x\n10\nc\u003e\u003e\u003e 10 + 10\n20\n\nc\u003e\u003e\u003e :py\nswitched to python\n\npython\u003e\u003e\u003e y = 10\npython\u003e\u003e\u003e y\n10\npython\u003e\u003e\u003e print(y)\n10\npython\u003e\u003e\u003e z = 4\npython\u003e\u003e\u003e z is y\nFalse\npython\u003e\u003e\u003e z == y\nFalse\n```\n\nDEB*FILE=$(curl -s https://api.github.com/repos/Esubaalew/run/releases/latest \\\n | grep -oE 'run*[0-9.]+\\_amd64\\.deb' | head -n 1)\ncurl -LO \"https://github.com/Esubaalew/run/releases/latest/download/${DEB_FILE}\"\ncurl -LO \"https://github.com/Esubaalew/run/releases/latest/download/${DEB_FILE}.sha256\"\nsha256sum --check \"${DEB_FILE}.sha256\"\n  sudo apt install \"./${DEB_FILE}\"\n\n### Built-in REPL Commands\n\n```\n:help              → Show help and available commands\n:languages         → List all supported languages\n:clear             → Clear the screen\n:exit or :quit     → Exit the REPL\n:lang \u003clanguage\u003e   → Switch to a different language\nCtrl+D             → Exit the REPL\n```\n\n---\n\n## Stdin Piping Examples\n\n`run` supports piping input from stdin to your code snippets across all languages. Here are more examples for different languages:\n\n### Node.js (JSON Processing)\n\n```bash\necho '{\"name\":\"Ada\"}' | run js --code \"const data = JSON.parse(require('fs').readFileSync(0, 'utf8')); console.log(`hi ${data.name}`)\"\n```\n\nOutput:\n\n```\nhi Ada\n```\n\n### Python (Uppercase Conversion)\n\n```bash\necho \"Hello from stdin\" | run python --code \"import sys; print(sys.stdin.read().strip().upper())\"\n```\n\nOutput:\n\n```\nHELLO FROM STDIN\n```\n\n### Go (Greeting)\n\n```bash\necho \"world\" | run go --code 'import \"fmt\"; import \"bufio\"; import \"os\"; scanner := bufio.NewScanner(os.Stdin); scanner.Scan(); fmt.Printf(\"Hello, %s!\\n\", scanner.Text())'\n```\n\nOutput:\n\n```\nHello, world!\n```\n\n### Ruby (Line Counting)\n\n```bash\necho -e \"line1\\nline2\\nline3\" | run ruby --code \"puts gets(nil).lines.count\"\n```\n\nOutput:\n\n```\n3\n```\n\n### Bash (Echo with Prefix)\n\n```bash\necho \"input text\" | run bash --code 'read line; echo \"Processed: $line\"'\n```\n\nOutput:\n\n```\nProcessed: input text\n```\n\n---\n\n## Language-Specific Notes\n\nFor detailed usage, quirks, and best practices for each language, visit the dedicated documentation:\n\n- [Python](https://run.esubalew.et/): Tips for scripting, data processing, and REPL persistence.\n- [JavaScript/Node.js](https://run.esubalew.et/): Async code, modules, and stdin handling.\n- [Rust](https://run.esubalew.et/): Compilation flags, error handling, and workspace management.\n- [Go](https://run.esubalew.et/): Package imports, build optimizations, and concurrency examples.\n- [C/C++](https://run.esubalew.et/): Compiler selection, linking, and multi-file support.\n- **C++**: Remember to include the standard headers your snippet depends on—`std::cout` and friends require `#include \u003ciostream\u003e`. When in doubt, wrap the snippet in a minimal `main` for portability:\n  ```bash\n  cat \u003c\u003c'EOF' | run cpp\n  #include \u003ciostream\u003e\n  int square(int x) { return x * x; }\n  int main() {\n      std::cout \u003c\u003c square(7) \u003c\u003c std::endl;\n      return 0;\n  }\n  EOF\n  ```\n  Skipping the include or `main` will lead to compiler errors such as `use of undeclared identifier 'std'`.\n- **C**: Avoid piping code through the shell’s `printf`—it expands `%d`, `\\n`, and friends before `run` sees the source. Use quoted here-docs instead so the compiler gets the exact text you typed:\n  ```bash\n  cat \u003c\u003c'EOF' | run c\n  #include \u003cstdio.h\u003e\n  int main() {\n      int value = 10;\n      printf(\"%d\\n\", value);\n      return 0;\n  }\n  EOF\n  ```\n- [Java](https://run.esubalew.et/): Classpath management, JVM args, and enterprise patterns.\n- [TypeScript](https://run.esubalew.et/): Type checking, Deno vs Node, and transpilation.\n- **Groovy**: When piping code via here-docs, quote the delimiter (`\u003c\u003c'EOF'`) so the shell doesn’t expand `$variables` before Groovy sees them. Example:\n  ```bash\n  cat \u003c\u003c'EOF' | run groovy\n  def name = \"Esubalew\"\n  println \"Hello, $name!\"\n  EOF\n  ```\n  Without quoting, shells like Bash erase the interpolation and Groovy prints `Hello, !`.\n- **TypeScript (Deno)**: `run` uses Deno for TypeScript execution. Deno requires explicit module specifiers and does not accept bare Node builtin names like `fs` — use the `node:` prefix for Node builtins (for example `import fs from \"node:fs\"`). Also prefer a quoted here-doc for multi-line snippets to avoid shell interpolation/globbing issues. Example:\n  ```bash\n  # here-doc (recommended)\n  cat \u003c\u003c'EOF' | run typescript\n  import fs from \"node:fs\";\n  console.log('[TypeScript] hello');\n  EOF\n  ```\n  Safe inline (zsh):\n  ```bash\n  run --lang typescript --code $'import fs from \"node:fs\";\\nconsole.log(\"[TypeScript] hello\");\\n'\n  ```\n- **Dart**: Inline `--code` snippets are written to a temporary `.dart` file and executed with `dart run`. However, shell quoting still matters — single quotes or unescaped characters will cause zsh to attempt globbing or parameter expansion. Use a quoted here-doc to avoid that problem. Example:\n  ```bash\n  # here-doc (recommended)\n  cat \u003c\u003c'EOF' | run dart\n  void main() {\n    print('[Dart] hello');\n  }\n  EOF\n  ```\n  Safe inline (zsh):\n  ```bash\n  run --lang dart --code $'void main() { print(\"[Dart] hello\"); }\\n'\n  ```\n- [And more...](https://run.esubalew.et/docs/overview) for all 25+ languages including Ruby, PHP, Haskell, Elixir, and specialized ones like R and Julia.\n\nEach language doc covers:\n\n- Toolchain requirements and detection\n- REPL-specific features (e.g., persistent state)\n- Common pitfalls and workarounds\n- Advanced examples (e.g., file I/O, networking)\n\n---\n\n## License\n\nApache 2.0. See [LICENSE](LICENSE) for details.\n\n---\n\nBuilt with ❤️ in Rust. If `run` unblocks your workflow, star the repo and share it with other polyglot hackers.\n","funding_links":[],"categories":["Applications","Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEsubaalew%2Frun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEsubaalew%2Frun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEsubaalew%2Frun/lists"}