{"id":17478585,"url":"https://github.com/nixpulvis/oursh","last_synced_at":"2025-05-12T04:30:32.583Z","repository":{"id":44173455,"uuid":"140375939","full_name":"nixpulvis/oursh","owner":"nixpulvis","description":"Your comrade through the perilous world of UNIX.","archived":false,"fork":false,"pushed_at":"2024-02-19T22:06:57.000Z","size":16896,"stargazers_count":67,"open_issues_count":30,"forks_count":6,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-05-10T10:45:05.225Z","etag":null,"topics":["posix","rust","shell"],"latest_commit_sha":null,"homepage":"http://nixpulvis.com/oursh/oursh","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nixpulvis.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,"publiccode":null,"codemeta":null}},"created_at":"2018-07-10T04:12:28.000Z","updated_at":"2025-03-14T04:46:50.000Z","dependencies_parsed_at":"2024-10-27T12:57:42.481Z","dependency_job_id":"83486ca7-b59e-477b-9a1a-d680d246eba6","html_url":"https://github.com/nixpulvis/oursh","commit_stats":{"total_commits":420,"total_committers":3,"mean_commits":140.0,"dds":0.004761904761904745,"last_synced_commit":"0e2be4ab081c571c505a6691db134450cf29ae06"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixpulvis%2Foursh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixpulvis%2Foursh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixpulvis%2Foursh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixpulvis%2Foursh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nixpulvis","download_url":"https://codeload.github.com/nixpulvis/oursh/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253675054,"owners_count":21945888,"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":["posix","rust","shell"],"created_at":"2024-10-18T20:29:03.159Z","updated_at":"2025-05-12T04:30:32.143Z","avatar_url":"https://github.com/nixpulvis.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oursh\n[![Documentation](https://docs.rs/oursh/badge.svg)](https://docs.rs/oursh)\n[![CI](https://github.com/nixpulvis/oursh/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/nixpulvis/oursh/actions/workflows/ci.yml)\n[![Dependencies](https://deps.rs/repo/github/nixpulvis/oursh/status.svg)](https://deps.rs/repo/github/nixpulvis/oursh)\n\nThis shell should be both POSIX compatible and yet modern and exciting. Fancy\nfeatures should not be prevented by POSIX compatibility. This will effect the\ndesign of the shell.\n\nThe name of the shell is `oursh` which is both somewhat unique, and memorable.\nIt's also a nice name to play with pseudo-satirical themes... right comrade?\nIt's short (ish) and sneakily fits `rs` in it, which is the extension of Rust\nprograms, the language this will be written in.\n\n## Features\n\n- [ ] [POSIX compatibility](https://github.com/nixpulvis/oursh/milestone/1)\n    - [x] Simple commands `ls`\n    - [ ] Quotes (#28) `echo \"foo\"; echo 'bar'`\n    - [x] Assignment `LOG=trace cargo run`\n    - [x] Variables `echo $foo`\n    - [ ] Special variables ($54) `echo $?; echo $1`\n    - [x] Boolean status syntax `! true \u0026\u0026 false || true`\n    - [x] Conditionals `if ; then ; elif ; then ; else ; fi`\n    - [x] Compound commands `{ ls; date; }`\n    - [ ] Subshells `\\$(sleep 1; date)`\n    - [x] Background jobs `{ sleep 1; date; }\u0026 date`\n    - [x] Redirection `date \u003e now.txt`\n    - [ ] Pipes `ls | wc -l`\n- [ ] Shebang block programs\n    - [ ] Alternate syntax `{# ...}`\n    - [ ] Hashlang syntax `{#lang; ...}`, i.e. `{#posix ls}`\n    - [x] Shebang syntax `{#!/usr/bin/env ruby; puts :sym}`\n- [ ] bash/zsh autocomplete compatibility\n    - [ ] Command completion\n    - [ ] Path completion\n    - [ ] Variable completion\n    - [ ] Job completion\n    - [ ] Syntax completion\n    - [ ] `man` / `-h` / `--help` parsing\n- [ ] Multi-line input\n- [ ] Modern scripting language\n    - [ ] Macros\n    - [ ] Types\n    - [ ] Higher-order functions\n    - [ ] Threading?\n- [ ] Obfuscated strings (`!'password'!`)\n- [ ] Time every command\n- [ ] mosh like remote session support\n- [ ] Smart history, sync'd across devices\n- [ ] Pipe old commands without rerunning\n- [ ] Package manager\n- Sane defaults\n- Fast\n\n## Releases, Tags, and Branches\n\nThe `master` branch will run both the [`release`][action-release] and\n[`ci`][action-ci] actions, whereas `develop` only runs `ci`. All pull requests\ninto `master` and release tagged (i.e. vX.Y.Z) pushes also trigger `release`\nbuilds.\n\n## Usage\n\nWhile this project is in early stages, there are no OS packages to use.\nHowever, you can compile and run directly from source easily. Just ensure you\nhave [`rustup`][rustup] installed.\n\n```sh\ncargo build\ncargo run\n```\n\n\n## Testing\n\nWe have four kinds of tests in this program. Crate unit tests, Executable unit\ntests, subprocess based integration tests, and documentation tests.\n\n```sh\n# Run all tests.\ncargo test\n```\n\n\n## Previous Work\n\nI've been using [`fish`][fish] as my main shell for a few years now. Fish\ninspires a lot of the modern syntax.\n\nPOSIX compatibility comes from my desire to use this shell as my `chsh -s ...`\nshell on [Arch Linux][arch]. See the full POSIX reference for more information.\n\nSome of the shebang language interoperation was inspired by my time with the\nNortheastern University PL group, and generally from writing [Racket][racket].\nThe beauty of of merging the UNIX style `#!...` with Racket's `#lang ...` here\nis very exciting to me. I might just _have_ to make a `{#lang ...}` shortcut\nfor Racket!\n\nI've built and wrote a few things about shells before:\n\n- [`rush`][rush] A glorified homework assignment for computer architecture\n- [`shell.py`][shell.py] My submission for computer organization a8\n- [Building a Shell - Part 1][basp1] Start of this project\n- [Building a Shell - Part 2][basp2] `program` module intro\n\n\n## [POSIX Reference][posix]\n\nSee the following sections for building the POSIX `sh` compliant program\nlanguage, and interactive terminal based REPL.\n\n- 3§2 Shell Command Language\n    - 10.2 Shell Grammar Rules\n- 2§2.5 Standard I/O Streams\n- 3§1.6 Built-In Utilities\n- 3§1.4 Utility Description Defaults\n- 2§2.3 Error Numbers\n- 1§11 General Terminal Interface\n- 2§2.4 Signal Concepts\n\n\n## Implementation\n\nThis shell will be written in Rust with minimal dependencies. Notably\n[termios][termios] and [libc][libc] will likely be used. The parsing library\nwill be [lalrpop][lalrpop], which should support the syntax we want somewhat\neasily, though grammar's in general can be a tricky beast.\n\nWe will want to create a few internal modules for the shell.\n\n**This design is subject to change.**\n\n- `process` - sub-process execution management.\n- `program` - parser and interpreter for the syntax of the shell.\n    - `posix` - POSIX (`sh`-like) syntax.\n    - `modern` - Modified syntax for supporting \"modern\" features, like lambdas.\n- `repl` - syntax aware, read eval print loop for an underlying terminal.\n    - `history` - records previous execution to a shared DB.\n    - `completion` - searches for autocompletions based on partial syntax.\n        - `bash` - bash completion support.\n        - `zsh` - zsh completion support.\n        - `parse` - dynamic completion generation, from `man` for example.\n    - `sync` - remote session and DB synchronization.\n- `invocation` - loading for `.ourshrc` and others.\n- `package` - simplistic package manager support (builtin function).\n\n---\n\n_Current modules as of: 2018-10-14_\n\n```\n oursh : crate\n ├── job : public\n ├── program : public\n │   ├── basic : public\n │   └── posix : public\n │       ├── ast : public\n │       │   └── tests : private @ #[cfg(test)]\n │       ├── builtin : public\n │       └── lex : public\n │           └── tests : private @ #[cfg(test)]\n ├── repl : public\n │   ├── completion : public @ #[cfg(feature = \"completion\")]\n │   └── history : public @ #[cfg(feature = \"history\")]\n └── tests : private @ #[cfg(test)]└── tests : private @ #[cfg(test)]\n```\n\n\n[documentation]: https://nixpulvis.com/oursh/oursh\n[action-release]: https://github.com/nixpulvis/oursh/blob/master/.github/workflows/release.yml\n[action-ci]: https://github.com/nixpulvis/oursh/blob/master/.github/workflows/ci.yml\n[rustup]: https://github.com/rust-lang-nursery/rustup.rs\n[posix]: http://pubs.opengroup.org/onlinepubs/9699919799/\n[termios]: https://crates.io/crates/termios\n[libc]: https://crates.io/crates/libc\n[lalrpop]: https://github.com/lalrpop/lalrpop\n[fish]: https://github.com/fish-shell/fish-shell\n[arch]: https://www.archlinux.org/\n[racket]: https://racket-lang.org/\n[rush]: https://github.com/nixpulvis/rush\n[shell.py]: /doc/shell.py\n[basp1]: https://nixpulvis.com/ramblings/2018-07-11-building-a-shell-part-1\n[basp2]: https://nixpulvis.com/ramblings/2018-10-15-building-a-shell-part-2\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixpulvis%2Foursh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnixpulvis%2Foursh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixpulvis%2Foursh/lists"}