{"id":13442421,"url":"https://github.com/dundalek/closh","last_synced_at":"2025-04-05T07:01:20.583Z","repository":{"id":47326102,"uuid":"109022423","full_name":"dundalek/closh","owner":"dundalek","description":"Bash-like shell based on Clojure","archived":false,"fork":false,"pushed_at":"2022-12-05T02:30:31.000Z","size":2278,"stargazers_count":1627,"open_issues_count":65,"forks_count":66,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-03-29T06:04:03.105Z","etag":null,"topics":["bash","cli","clojure","clojurescript","closh","shell"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dundalek.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-31T16:23:51.000Z","updated_at":"2025-03-22T15:40:46.000Z","dependencies_parsed_at":"2023-01-23T00:30:14.597Z","dependency_job_id":null,"html_url":"https://github.com/dundalek/closh","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundalek%2Fclosh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundalek%2Fclosh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundalek%2Fclosh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dundalek%2Fclosh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dundalek","download_url":"https://codeload.github.com/dundalek/closh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299828,"owners_count":20916190,"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":["bash","cli","clojure","clojurescript","closh","shell"],"created_at":"2024-07-31T03:01:45.507Z","updated_at":"2025-04-05T07:01:20.518Z","avatar_url":"https://github.com/dundalek.png","language":"Clojure","funding_links":[],"categories":["Clojure","Terminal UI"],"sub_categories":[],"readme":"\n\u003cimg src=\"doc/img/logo/verticalversion.png\" align=\"right\" alt=\"closh\" height=\"150px\" style=\"border: none; float: right;\"\u003e\n\n# closh - Bash-like shell based on Clojure\n\n[![Chat about Closh at Zulip](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://clojurians.zulipchat.com/#narrow/stream/195273-closh) [![Join the chat at https://gitter.im/closh/Lobby](https://badges.gitter.im/closh/Lobby.svg)](https://gitter.im/closh/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) [![Build status on CircleCI](https://circleci.com/gh/dundalek/closh.svg?style=shield)](https://circleci.com/gh/dundalek/closh) [![GitHub release](https://img.shields.io/github/tag/dundalek/closh.svg?label=release\u0026colorB=blue)](https://github.com/dundalek/closh/releases)\n\n\u003e  **Status update 2022**: Closh is now on hiatus.  \n\u003e Although the initial proof of concept turned out promising, it would take much more work to make it a robust tool that could be relied upon by a wider audience.  \n\u003e For now I recommend using [fish](https://fishshell.com/) as an interactive shell and [babashka](https://babashka.org/) for scripts.\n\nClosh combines the best of traditional unix shells with the power of [Clojure](https://clojure.org/). It aims to be a modern alternative to bash.\n\nDemo showing how to execute commands and using Clojure to manipulate outputs in shell:\n\n![closh demo screencast](./doc/img/demo.gif)\n\nWhy try to reinvent bash?\n- Bash has obscure syntax for non-trivial operations and lots of WTF moments.\n- It treats everything as text while we mostly need to manipulate structured information.\n- It is a large codebase which makes it difficult to hack on it and try innovative ideas. Which is one of the reasons why the shell did not improve much in recent decades.\n- Traditional shells are limited in terms of presentation and discoverability, what if we could bring back richer environment as imagined by lisp machines?\n\nWhy shell based on Clojure(Script)?\n- Clojure's has a simple syntax and well-thought design which makes it pleasurable to work with.\n- Its extensive collection of powerful functions for data manipulation is suitable to provide solutions for daily tasks.\n- Write shell scripts in a language you use daily for development so you don't have to google arcane shell constructs every time you need to do anything but simplest tasks.\n- Less amount and more composable code allows to experiment with new features and ideas.\n\n**Warning:** *Closh is still in a early stage and under a heavy development, has many rough edges and is subject to change a lot. Closh is tested on Linux, should run on macOS too.*\n\n## Community and Contribution\n\nIf you have feedback about a specific feature or found a bug please open an [issue](https://github.com/dundalek/closh/issues).  \nUse [reddit](https://reddit.com/r/closh) for general discussion and to share scripts and workflows.\nChat room is on [zulip](https://clojurians.zulipchat.com/#narrow/stream/195273-closh) or [gitter](https://gitter.im/closh/Lobby).\n\nIf you would like to contribute take look at [open issues](https://github.com/dundalek/closh/issues). Leave a comment if you find anything interesting  and we can improve the project together.\n\n## Install\n\n**Windows** proper is currently **NOT supported**, but it should run under WSL 2. If you know your way around with Windows, we need your help (see [#54](https://github.com/dundalek/closh/issues/54)).\n\n**[Try closh online](https://repl.it/@dundalek/closh-playground)** in the browser without installing anything.\n\n### Clojure/JVM version\n\nDownload the jar file from the [releases page](https://github.com/dundalek/closh/releases) and run it with:\n```sh\njava -jar closh-zero.jar\n```\n\nThe jar file also contains a special header, so once you make it executable you can run it directly:\n```sh\nchmod +x closh-zero.jar\n./closh-zero.jar\n```\n\nIt can also run with `clojure` CLI:\n```sh\nclojure -Sdeps '{:deps {closh {:git/url \"https://github.com/dundalek/closh.git\" :tag \"v0.5.0\" :sha \"6a7c0aa293616e2d28f7f735e915a301e44d2121\"}}}' -m closh.zero.frontend.rebel\n```\n\n### ClojureScript/Lumo version\n\nInstall closh (requires [Node.js](https://nodejs.org/) version 9.x, support for version 10 is in progress, see [#113](https://github.com/dundalek/closh/issues/113)):\n```\nnpm install -g closh\n```\n\nIf you get a [permission error](https://github.com/dundalek/closh/issues/85) then try:\n```\nnpm install -g closh --unsafe-perm\n```\n\nTo install development version from master branch:\n```\nnpm i -g dundalek/closh\n```\n\n## Quick Start\n\nStart the shell:\n```sh\nclosh\n```\n\nRun simple commands like you are used to:\n\n```clojure\n$ echo hi\n\n$ git status\n\n$ ls -l *.json\n```\n\nCommands starting with a parenthesis are evaluated as Clojure code:\n\n```clojure\n$ (+ 1 2)\n; =\u003e 3\n```\n\nThe power comes from combining shell commands and Clojure:\n\n```clojure\n$ echo hi | (clojure.string/upper-case)\n; =\u003e HI\n\n$ ls *.json |\u003e (reverse)\n\n; Count number of files grouped by first letter sorted by highest count first\n$ ls |\u003e (group-by first) | (map #(update % 1 count)) | (sort-by second) | (reverse)\n```\n\nIf you like closh you can set it as your default shell.\n\nBe careful and first test closh from other shell to make sure it works on your machine so you don't get locked out of shell (after `chsh` you need to log out and log back in for changes to take effect):\n```sh\nwhich closh | sudo tee -a /etc/shells\nchsh -s $(which closh)\n```\n\nFor the JVM version you can make it the default shell similarly like:\n```sh\nclosh=/path/to/closh-zero.jar\nchmod +x $closh\necho $closh | sudo tee -a /etc/shells\nchsh -s $closh\n```\n\n## Documentation\n\n- [Guide and Reference](./doc/guide.md) - Introduction to closh and basic configuration\n- [Shell scripting](./doc/scripting.md) - Guide how to use Closh to write shell scripts\n- [Cookbook](./doc/cookbook.md) - Recipes for integration of other tools like NVM, Autojump, etc.\n- [Design Principles](./doc/principles.md) - Learn about the philosophy and what guides design decisions\n- [Tech notes](./doc/tech.md) - Read about internals and architecture\n- [Notes on Existing Shells](./doc/notes.md)\n- [Changelog](./CHANGELOG.md)\n\n## Roadmap\n\n#### Terminal UI improvements and exploration\n\nExplore innovate UI ideas, explore what a shell could become and all possibilities within an ASCII terminal. The goal is to reimagine what people think a command line interface is without having to lose its core power.\n\n- [ ] Try to integrate [Liquid](https://github.com/mogenslund/liquid) as the editor interface, which would enable us:\n  - [ ] Better and more flexible readline experience\n  - [ ] Customizable key bindings\n- [ ] Try  to explore [Trikl](https://github.com/lambdaisland/trikl) for building [interactive command-line interfaces](http://dundalek.com/entropic/combining-cli-and-gui/)\n- [ ] Data helpers that automatically parse command output into data structures\n- [ ] Automatic abbreviation suggestion\n- [ ] Explore launcher functionality similar to Alfred, Lacona and others\n\n#### More UI exploration\n\nExplore if we could take shell power and functionality and lift it from the boundaries set by ASCII terminals.\n\n- [ ] Structured graphical output ala [TermKit](https://github.com/unconed/TermKit) or [lisp machines](https://youtu.be/o4-YnLpLgtk?t=3m12s)\n- [ ] Explore possibilty of a web interface\n\n#### Stabilization and performance\n\nI hope that new UI ideas above will get people excited and interested. After that we should work on stabilization and adding all the remaining features people are used to from traditional shells.\n\n- [ ] Implement a low-level native pipeline library to improve performance\n- [ ] Make it more robust and better error handling\n- [ ] Job control\n\n## Limitations\n\n### JVM version (CLJ)\n\n- [Abbreviations do not work](https://github.com/dundalek/closh/issues/151)\n- Cannot redirect STDIO \u003e= 3 (Java ProcessBuilder limitation)\n\n### Lumo version (CLJS)\n\n- No script mode\n- No syntax highlighting\n- [Prompt quirks](https://github.com/dundalek/closh/issues/71)\n- Synchronous execution hacks (via deasync library)\n\n## Development\n\nClone the repo and install dependencies\n\n```\ngit clone git@github.com:dundalek/closh.git\ncd closh\nnpm install\n```\n\nRun the cljs app\n```\nnpm start\n```\n\nRun the clj app\n```\nclojure -m closh.zero.frontend.rebel\n```\n\nRun tests once\n```\nnpm run test\n```\n\nRe-run tests on change\n```\nnpm run test-auto\n```\n\n### Manual Java builds\n\nRun `npm run pkg-java`. The resulting binary will be in `target/closh-zero.jar`.\n\n## Sponsors\n\nThank you for the support:\n\n- [AdGoji](https://www.adgoji.com/)\n\n## Mentions\n\n- [Hacker News](https://news.ycombinator.com/item?id=15600928)\n- [root.cz](https://www.root.cz/clanky/softwarova-sklizen-19-12-2018/)\n\n## Copyright \u0026 License\n\nCopyright (c) Jakub Dundalek and contributors\n\nDistributed under the Eclipse Public License 1.0 (same as Clojure).\n\nLogo created by [@batarian71](https://github.com/batarian71) under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdundalek%2Fclosh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdundalek%2Fclosh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdundalek%2Fclosh/lists"}