{"id":16614964,"url":"https://github.com/denysdovhan/robbyrussell-node","last_synced_at":"2025-03-17T10:07:16.212Z","repository":{"id":65265017,"uuid":"78146932","full_name":"denysdovhan/robbyrussell-node","owner":"denysdovhan","description":"Cross-shell robbyrussell theme written in JavaScript","archived":false,"fork":false,"pushed_at":"2022-04-24T16:37:28.000Z","size":109,"stargazers_count":169,"open_issues_count":3,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T00:09:53.212Z","etag":null,"topics":["javascript-shells","prompt","prompts","shell"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/denysdovhan.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}},"created_at":"2017-01-05T20:44:40.000Z","updated_at":"2025-01-26T05:01:47.000Z","dependencies_parsed_at":"2023-01-16T15:00:44.520Z","dependency_job_id":null,"html_url":"https://github.com/denysdovhan/robbyrussell-node","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denysdovhan%2Frobbyrussell-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denysdovhan%2Frobbyrussell-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denysdovhan%2Frobbyrussell-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denysdovhan%2Frobbyrussell-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denysdovhan","download_url":"https://codeload.github.com/denysdovhan/robbyrussell-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243783295,"owners_count":20347404,"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":["javascript-shells","prompt","prompts","shell"],"created_at":"2024-10-12T02:08:20.919Z","updated_at":"2025-03-17T10:07:16.189Z","avatar_url":"https://github.com/denysdovhan.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Prompts"],"readme":"![robbyrussell-img][robbyrussell-img]\n\n# robbyrussell-node\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js version][node-image]][node-url]\n[![Dependency status][depstat-image]][depstat-url]\n[![Build status][buildstat-image]][buildstat-url]\n[![Donate][donate-image]][donate-url]\n\n\u003e Cross-shell [robbyrussell] theme written in JavaScript\n\n## Motivation\n\nI'm developing 🚀⭐️ [spaceship-zsh-theme] which is an extremely powerful and customizable prompt for ZSH. It supports a lot of environments and tools to make you enjoy using it. However, there are plenty issues I faced: zsh is hard, dependency management is difficult, testing is near to impossible and so on.\n\nThis project is just a proof of concept. Definitely, that's not the best implementation, nevertheless, it opens interesting possibilities:\n\n* **high-level language** — ZSH is nice, but not for programming. JavaScript or Python seems more comfortable for these cases.\n* **single code base** — Single source code for all shells. The core logic is written in a high-level language while the shell-specific code is located in special files called _adapters_.\n* **cross-shell** — different shells are too specific. Single code base on high-level language with unified interface gives us an ability to use it with any shell(fish, zsh, bash, sh, etc).\n* **cross-platform** — things like [`pkg`](https://github.com/zeit/pkg) allows us to package prompt into binary and use it wherever we want, even without installed language runtime.\n* **testable** — high-level language and its infrastructure make it possible to test prompt components with tools like [Mocha](https://mochajs.org/), [Jest](https://facebook.github.io/jest/) or [tape](https://github.com/substack/tape) (unlike traditional prompts which are usually untested).\n* **dependency management** — [NPM](https://www.npmjs.com/), [RubyGems](https://rubygems.org/) and [PyPI](https://pypi.python.org/pypi) store thousands of packages that could be used for special prompt's needs. It's also possible to install prompt itself with one of these package managers.\n* **asynchronous checks** — the more synchronous checks you do, the slower prompt becomes. Things like [`async/await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) or [`Promise.all()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) could perform environment checks concurrently, so we can achieve significant performance improvement.\n\nWhy JavaScript? Just because it's a high-level language which provides wide infrastructure with a good package manager, lots of packages and good community. It's quite fast and easy to make a simple working example.\n\n## Installation\n\n### [npm](https://www.npmjs.com)\n\n```\nnpm install -g robbyrussell\n```\n\nDone. This command should source the corresponding adapter for your shell. Just reload your terminal.\n\n### Binaries\n\nIf you don't have Node.js installed on your machine, you can download pre-built binaries with built-in Node.js version.\n\n[**⬇️ Download binary ⬇️**](https://github.com/denysdovhan/robbyrussell-node/releases)\n\nUse them in your shell configuration with [adapters](https://github.com/denysdovhan/robbyrussell/tree/master/adapters).\n\n**bash:**\n\n```bash\n# BASH-specific adapter\nrobbyrussell_bash_adapter() {\n  robbyrussell_previous_exit_code=\"$?\"\n  /path/to/robbyrussell $robbyrussell_previous_exit_code 'bash'\n}\n\n# set prompt\nPS1='$(robbyrussell_bash_adapter)'\n```\n\n**zsh:**\n\n```zsh\n# ZSH-specific adapter\nrobbyrussell_zsh_adapter() {\n  robbyrussell_previous_exit_code=\"$?\"\n  /path/to/robbyrussell $robbyrussell_previous_exit_code 'zsh'\n}\n\n# set prompt\nPROMPT='$(robbyrussell_zsh_adapter)'\n```\n\n**fish:**\n\n```fish\n# FISH-specific adapter\nfunction robbyrussell_fish_adapter -d \"a robbyrussell theme adapter for fish\"\n  set robbyrussell_previous_exit_code \"$status\"\n  /path/to/robbyrussell $robbyrussell_previous_exit_code 'fish'\nend\n\n# set prompt\nfunction fish_prompt\n  # fish splits command substitutions on newlines\n  # need to temporarily reset IFS to empty\n  #   @see: http://stackoverflow.com/a/34186172/5508862\n  set -l IFS\n  robbyrussell_fish_adapter\nend\n\n```\n\n## Configuration\n\nExposing the pormpt settings as environment variables is a known problem. This prompt reads a special configuration file from your home directory, which allows you to define more complex configs. A prompt automatically looks for `~/.prompt-config.js` or `~/.prompt-config.json` files. These files should export configuration object.\n\n\u003e **Important:** A prompt needs to escape colors codes, otherwise it would behave incorrectly. This prompt includes patched [`chalk`](https://github.com/chalk/chalk) package with escape codes for current `process.env.SHELL`.\n\nDefault config looks like this:\n\n```js\n// Patched for current shell chalk/chalk colors\nconst styles = require('robbyrussell/utils/colors');\n\nmodule.exports = {\n  /**\n   * Check git status asynchronously\n   */\n  async: false,\n  /**\n   * Prompt prefix and suffix\n   */\n  prompt: {\n    open: styles.bold.open,\n    close: styles.bold.close + styles.reset.close\n  },\n  /**\n   * Status code\n   */\n  status: {\n    char: '➜',\n    success: styles.green.open,\n    failure: styles.red.open,\n  },\n  /**\n   * Directory style\n   */\n  dir: {\n    color: styles.cyan.open\n  },\n  /**\n   * Git status styles\n   */\n  git: {\n    indicator: styles.blue.open,\n    branch: styles.red.open,\n    dirty: styles.yellow.open,\n    dirtyChar: '✗'\n  }\n};\n```\n\n## License\n\nMIT © [Denys Dovhan](https://denysdovhan.com)\n\n\u003c!-- Badges --\u003e\n\n[npm-url]: https://npmjs.org/package/robbyrussell\n[npm-image]: https://img.shields.io/npm/v/robbyrussell.svg?style=flat-square\n\n[node-url]: https://nodejs.org/en/download/\n[node-image]: https://img.shields.io/node/v/robbyrussell.svg?style=flat-square\n\n[depstat-url]: https://david-dm.org/denysdovhan/robbyrussell-node\n[depstat-image]: https://david-dm.org/denysdovhan/robbyrussell-node.svg?style=flat-square\n\n[buildstat-url]: https://travis-ci.org/denysdovhan/robbyrussell-node\n[buildstat-image]: https://img.shields.io/travis/denysdovhan/robbyrussell-node.svg?style=flat-square\n\n[donate-url]: https://www.liqpay.com/en/checkout/380951100392\n[donate-image]: https://img.shields.io/badge/support-donate-yellow.svg?style=flat-square\n\n\u003c!-- References --\u003e\n\n[robbyrussell]: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#robbyrussell\n[robbyrussell-img]: https://cloud.githubusercontent.com/assets/3459374/26444261/5cc584ea-4144-11e7-8951-2648bc993980.png\n[spaceship-zsh-theme]: https://github.com/denysdovhan/spaceship-zsh-theme\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenysdovhan%2Frobbyrussell-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenysdovhan%2Frobbyrussell-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenysdovhan%2Frobbyrussell-node/lists"}