{"id":17016829,"url":"https://github.com/nnbnh/coderun","last_synced_at":"2025-04-12T09:32:22.679Z","repository":{"id":114416056,"uuid":"338586657","full_name":"NNBnh/coderun","owner":"NNBnh","description":"⏯️ Code runner CLI that can run any languages","archived":false,"fork":false,"pushed_at":"2022-07-02T03:58:02.000Z","size":93,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T04:51:07.508Z","etag":null,"topics":["basher","bpkg","cli","executor","posix","runner","terminal"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NNBnh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-02-13T13:58:56.000Z","updated_at":"2023-05-03T10:34:35.000Z","dependencies_parsed_at":"2024-02-23T11:55:19.690Z","dependency_job_id":null,"html_url":"https://github.com/NNBnh/coderun","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NNBnh%2Fcoderun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NNBnh%2Fcoderun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NNBnh%2Fcoderun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NNBnh%2Fcoderun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NNBnh","download_url":"https://codeload.github.com/NNBnh/coderun/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248546185,"owners_count":21122272,"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","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":["basher","bpkg","cli","executor","posix","runner","terminal"],"created_at":"2024-10-14T06:34:44.426Z","updated_at":"2025-04-12T09:32:22.417Z","avatar_url":"https://github.com/NNBnh.png","language":"Shell","funding_links":["https://www.buymeacoffee.com/nnbnh"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ci\u003eCoderun\u003c/i\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003eCode runner CLI that can run any languages\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/NNBnh/coderun/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/NNBnh/coderun?labelColor=073551\u0026color=4EAA25\u0026style=for-the-badge\" alt=\"License: GPL-3.0\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://gist.github.com/NNBnh/9ef453aba3efce26046e0d3119dab5a7#development-completed\"\u003e\u003cimg src=\"https://img.shields.io/badge/development-completed-%234EAA25.svg?labelColor=073551\u0026style=for-the-badge\u0026logoColor=FFFFFF\" alt=\"Development completed\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 💡 About\n\n**Coderun** is a code runner CLI written in [`portable sh`](https://github.com/dylanaraps/pure-sh-bible) that can run any languages.\n\nhttps://user-images.githubusercontent.com/43980777/108585543-92714300-737b-11eb-8296-1bf0cf79437f.mp4\n\n### 📔 Story\n\nAfter a long time searching for something like a CLI's version [Code Runner](https://github.com/formulahendry/vscode-code-runner) asking people on [r/kakoune](https://www.reddit.com/r/kakoune/comments/kuh4km/is_there_anything_like_code_runner_for_kakoune) and still doesn't find it, I decided to create my own with only **8 lines** of [`portable sh`](https://github.com/dylanaraps/pure-sh-bible):\n\n```sh\n#!/bin/sh\nDIRECTORY=$(dirname \"$1\")\nFILE=$(basename \"$1\")\nFULL=\"$DIRECTORY/$FILE\"\nNAME=\"${FILE%.*}\"\nEXTENSION=$(printf '%s' \"$FILE\" | sed -e \"s/^$NAME\\.*//\" -e 's/+/p/g' -e 's/-/_/g')\neval \"$(eval \"printf '%s' \\\"\\$CODERUN_$EXTENSION\\\"\")\"\nexit 0\n```\n\nand a [Kakoune](http://kakoune.org) plugin: [`coderun.kak`](https://github.com/NNBnh/coderun.kak).\n\n## 🚀 Setup\n\n### 🧾 Dependencies\n\n- [Unix commands](https://en.wikipedia.org/wiki/List_of_Unix_commands) to process\n- The language that you want to run (obviously)\n\n### 📥 Installation\n\n#### 🔧 Manually\n\nOption 1: using `curl`\n\n```sh\ncurl https://raw.githubusercontent.com/NNBnh/coderun/main/bin/coderun \u003e ~/.local/bin/coderun\nchmod +x ~/.local/bin/coderun\n```\n\nOption 2: using `git`\n\n```sh\ngit clone https://github.com/NNBnh/coderun.git ~/.local/share/coderun\nln -s ~/.local/share/coderun/bin/coderun ~/.local/bin/coderun\n```\n\n#### 📦 Package manager\n\nFor [Bpkg](https://github.com/bpkg/bpkg) user:\n\n```sh\nbpkg install NNBnh/coderun\n```\n\nFor [Basher](https://github.com/basherpm/basher) user:\n\n```sh\nbasher install NNBnh/coderun\n```\n\n\u003e **Note** *If you can and want to port Coderun to other package managers, feel free to do so.*\n\n## ⌨️ Usage\n\nRun `coderun` in the terminal:\n```sh\ncoderun FILE\n```\n\n\u003e **Note** *Coderun out of the box cannot run code, you need to [configure it](#%EF%B8%8F-configuration).*\n\n## ⚙️ Configuration\nCoderun is configured through environment variables: `export CODERUN_\u003cextension\u003e=\"\u003cmethod\u003e\"`\n\n`\u003cextension\u003e`:\n- Extension is case sensitive (e.g: `c` is different than `C`)\n- Because the shell does not accept values with some symbols so the characters in the side extension will be converted:\n  - From `+` to `p` (e.g: `c++ =\u003e cpp`)\n  - From `-` to `_` (e.g: `php-s =\u003e php_s`)\n\n`\u003cmethod\u003e`:\n- Keep in mind that the `\u003cmethod\u003e` will be run through `eval` (e.g: `// =\u003e /`)\n- Supported parameters:\n\n|  Parameter  |      Example     |   Description  |\n|-------------|------------------|----------------|\n|`\\$FULL`     |`/home/user/foo.c`|File's full path|\n|`\\$DIRECTORY`|`/home/user      `|File's directory|\n|`\\$FILE`     |`           foo.c`|File's base name|\n|`\\$NAME`     |`           foo  `|File's name only|\n|`\\$EXTENSION`|`               c`|File's extension|\n\nExamples:\n\n```sh\nexport CODERUN_=\"chmod +x \\$FULL \u0026\u0026 \\$FULL\"\nexport CODERUN_sh=\"$CODERUN_\"\nexport CODERUN_bash=\"bash \\$FULL\"\nexport CODERUN_zsh=\"zsh \\$FULL\"\nexport CODERUN_fish=\"fish \\$FULL\"\nexport CODERUN_1=\"man \\$FULL\"\nexport CODERUN_2=\"$CODERUN_1\"\nexport CODERUN_3=\"$CODERUN_1\"\nexport CODERUN_4=\"$CODERUN_1\"\nexport CODERUN_5=\"$CODERUN_1\"\nexport CODERUN_6=\"$CODERUN_1\"\nexport CODERUN_7=\"$CODERUN_1\"\nexport CODERUN_8=\"$CODERUN_1\"\nexport CODERUN_9=\"$CODERUN_1\"\nexport CODERUN_js=\"node \\$FULL\"\nexport CODERUN_cjs=\"$CODERUN_js\"\nexport CODERUN_mjs=\"$CODERUN_js\"\nexport CODERUN_java=\"cd \\$DIRECTORY \u0026\u0026 javac \\$FILE \u0026\u0026 java \\$NAME\"\nexport CODERUN_class=\"$CODERUN_java\"\nexport CODERUN_jar=\"$CODERUN_java\"\nexport CODERUN_c=\"cd \\$DIRECTORY \u0026\u0026 gcc \\$FILE -o \\$NAME \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_h=\"$CODERUN_c\"\nexport CODERUN_cc=\"cd \\$DIRECTORY \u0026\u0026 g++ \\$FILE -o \\$NAME \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_C=\"$CODERUN_cc\"\nexport CODERUN_cpp=\"$CODERUN_cc\"\nexport CODERUN_cxx=\"$CODERUN_cc\"\nexport CODERUN_hh=\"$CODERUN_cc\"\nexport CODERUN_H=\"$CODERUN_cc\"\nexport CODERUN_hpp=\"$CODERUN_cc\"\nexport CODERUN_hxx=\"$CODERUN_cc\"\nexport CODERUN_m=\"cd \\$DIRECTORY \u0026\u0026 gcc -framework Cocoa \\$FILE -o \\$NAME \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_mm=\"$CODERUN_m\"\nexport CODERUN_M=\"$CODERUN_m\"\nexport CODERUN_php=\"php \\$FULL\"\nexport CODERUN_phtml=\"$CODERUN_php\"\nexport CODERUN_php3=\"$CODERUN_php\"\nexport CODERUN_php4=\"$CODERUN_php\"\nexport CODERUN_php5=\"$CODERUN_php\"\nexport CODERUN_php7=\"$CODERUN_php\"\nexport CODERUN_phps=\"$CODERUN_php\"\nexport CODERUN_php_s=\"$CODERUN_php\"\nexport CODERUN_pht=\"$CODERUN_php\"\nexport CODERUN_phar=\"$CODERUN_php\"\nexport CODERUN_py=\"python -u \\$FULL\"\nexport CODERUN_pyi=\"$CODERUN_py\"\nexport CODERUN_pyc=\"$CODERUN_py\"\nexport CODERUN_pyd=\"$CODERUN_py\"\nexport CODERUN_pyo=\"$CODERUN_py\"\nexport CODERUN_pyw=\"$CODERUN_py\"\nexport CODERUN_pyz=\"$CODERUN_py\"\nexport CODERUN_perl=\"perl \\$FULL\"\nexport CODERUN_plx=\"$CODERUN_perl\"\nexport CODERUN_pl=\"$CODERUN_perl\"\nexport CODERUN_pm=\"$CODERUN_perl\"\nexport CODERUN_xs=\"$CODERUN_perl\"\nexport CODERUN_t=\"$CODERUN_perl\"\nexport CODERUN_pod=\"$CODERUN_perl\"\nexport CODERUN_rb=\"ruby \\$FULL\"\nexport CODERUN_go=\"go run \\$FULL\"\nexport CODERUN_gccgo=\"$CODERUN_go\"\nexport CODERUN_lua=\"lua \\$FULL\"\nexport CODERUN_groovy=\"groovy \\$FULL\"\nexport CODERUN_gvy=\"$CODERUN_groovy\"\nexport CODERUN_gy=\"$CODERUN_groovy\"\nexport CODERUN_gsh=\"$CODERUN_groovy\"\nexport CODERUN_ps1=\"powershell -ExecutionPolicy ByPass -File \\$FULL\"\nexport CODERUN_ps1xml=\"$CODERUN_ps1\"\nexport CODERUN_psc1=\"$CODERUN_ps1\"\nexport CODERUN_psd1=\"$CODERUN_ps1\"\nexport CODERUN_psm1=\"$CODERUN_ps1\"\nexport CODERUN_pssc=\"$CODERUN_ps1\"\nexport CODERUN_psrc=\"$CODERUN_ps1\"\nexport CODERUN_cdxml=\"$CODERUN_ps1\"\nexport CODERUN_cmd=\"cmd /c \\$FULL\"\nexport CODERUN_bat=\"$CODERUN_cmd\"\nexport CODERUN_btm=\"$CODERUN_cmd\"\nexport CODERUN_fsi=\"fsi \\$FULL\"\nexport CODERUN_fs=\"$CODERUN_fsi\"\nexport CODERUN_fsx=\"$CODERUN_fsi\"\nexport CODERUN_fsscript=\"$CODERUN_fsi\"\nexport CODERUN_cs=\"scriptcs \\$FULL\"\nexport CODERUN_csx=\"$CODERUN_cs\"\nexport CODERUN_vbs=\"cscript //Nologo \\$FULL\"\nexport CODERUN_vbe=\"$CODERUN_vbs\"\nexport CODERUN_wsf=\"$CODERUN_vbs\"\nexport CODERUN_wsc=\"$CODERUN_vbs\"\nexport CODERUN_ts=\"ts-node \\$FULL\"\nexport CODERUN_tsx=\"$CODERUN_ts\"\nexport CODERUN_coffee=\"coffee \\$FULL\"\nexport CODERUN_litcoffee=\"$CODERUN_coffee\"\nexport CODERUN_scala=\"scala \\$FULL\"\nexport CODERUN_sc=\"$CODERUN_scala\"\nexport CODERUN_swift=\"swift \\$FULL\"\nexport CODERUN_jl=\"julia \\$FULL\"\nexport CODERUN_cr=\"crystal \\$FULL\"\nexport CODERUN_ml=\"ocaml \\$FULL\"\nexport CODERUN_mli=\"$CODERUN_ml\"\nexport CODERUN_r=\"Rscript \\$FULL\"\nexport CODERUN_rdata=\"$CODERUN_r\"\nexport CODERUN_rds=\"$CODERUN_r\"\nexport CODERUN_rda=\"$CODERUN_r\"\nexport CODERUN_scpt=\"osascript \\$FULL\"\nexport CODERUN_scptd=\"$CODERUN_scpt\"\nexport CODERUN_applescript=\"$CODERUN_scpt\"\nexport CODERUN_clj=\"lein exec \\$FULL\"\nexport CODERUN_cljs=\"$CODERUN_clj\"\nexport CODERUN_cljc=\"$CODERUN_clj\"\nexport CODERUN_edn=\"$CODERUN_clj\"\nexport CODERUN_hx=\"haxe --cwd \\$DIRECTORY --run \\$NAME\"\nexport CODERUN_hxml=\"$CODERUN_hx\"\nexport CODERUN_rs=\"cd \\$DIRECTORY \u0026\u0026 rustc \\$FILE \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_rlib=\"$CODERUN_rs\"\nexport CODERUN_rkt=\"racket \\$FULL\"\nexport CODERUN_scm=\"csi -script \\$FULL\"\nexport CODERUN_ss=\"$CODERUN_scm\"\nexport CODERUN_ahk=\"autohotkey \\$FULL\"\nexport CODERUN_au3=\"autoit3 \\$FULL\"\nexport CODERUN_dart=\"dart \\$FULL\"\nexport CODERUN_pp=\"cd \\$DIRECTORY \u0026\u0026 fpc \\$FILE \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_pas=\"$CODERUN_pp\"\nexport CODERUN_inc=\"$CODERUN_pp\"\nexport CODERUN_d=\"cd \\$DIRECTORY \u0026\u0026 dmd \\$FILE \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_hs=\"runhaskell \\$FULL\"\nexport CODERUN_lhs=\"$CODERUN_hs\"\nexport CODERUN_nim=\"nim compile --verbosity:0 --hints:off --run \\$FULL\"\nexport CODERUN_nims=\"$CODERUN_nim\"\nexport CODERUN_nimbls=\"$CODERUN_nim\"\nexport CODERUN_lisp=\"sbcl --script \\$FULL\"\nexport CODERUN_kit=\"kitc --run \\$FULL\"\nexport CODERUN_v=\"v run \\$FULL\"\nexport CODERUN_sass=\"sass --style expanded \\$FULL\"\nexport CODERUN_scss=\"scss --style expanded \\$FULL\"\nexport CODERUN_less=\"cd \\$DIRECTORY \u0026\u0026 lessc \\$FILE \\$NAME.css\"\nexport CODERUN_f=\"cd \\$DIRECTORY \u0026\u0026 gfortran \\$FILE -o \\$NAME \u0026\u0026 \\$DIRECTORY/\\$NAME\"\nexport CODERUN_for=\"$CODERUN_f\"\nexport CODERUN_f90=\"$CODERUN_f\"\n```\n\n\u003e **Note** *This config is mostly ported from [Code Runner](https://github.com/formulahendry/vscode-code-runner/blob/101a718478136f5a7022fd4d4aaa22bf9a82176d/package.json#L127-L176).*\n\n## 💌 Credits\nSpecial thanks to:\n- [**Code Runner**](https://github.com/formulahendry/vscode-code-runner) by [Jun Han](https://github.com/formulahendry)\n- [**Case insensitive extension feature**](https://github.com/NNBnh/coderun/releases/tag/1.1.0) by [Elias Lundell](https://github.com/LogFlames)\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n---\n\n\u003e \u003ch1 align=\"center\"\u003eMade with ❤️ by \u003ca href=\"https://github.com/NNBnh\"\u003e\u003ci\u003eNNB\u003c/i\u003e\u003c/a\u003e\u003c/h1\u003e\n\u003e\n\u003e \u003cp align=\"center\"\u003e\u003ca href=\"https://www.buymeacoffee.com/nnbnh\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy_me_a_coffee%20-%23F7CA88.svg?logo=buy-me-a-coffee\u0026logoColor=333333\u0026style=for-the-badge\" alt=\"Buy Me a Coffee\"\u003e\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnbnh%2Fcoderun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnbnh%2Fcoderun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnbnh%2Fcoderun/lists"}