{"id":16156867,"url":"https://github.com/saghul/shline","last_synced_at":"2026-04-02T01:13:36.813Z","repository":{"id":29414488,"uuid":"32950026","full_name":"saghul/shline","owner":"saghul","description":"A simple powerline style prompt for my bash shell","archived":false,"fork":false,"pushed_at":"2015-09-20T20:11:14.000Z","size":352,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-05T11:03:39.509Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/saghul.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":"2015-03-26T20:25:06.000Z","updated_at":"2018-01-15T20:21:13.000Z","dependencies_parsed_at":"2022-09-06T18:11:40.302Z","dependency_job_id":null,"html_url":"https://github.com/saghul/shline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saghul/shline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saghul%2Fshline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saghul%2Fshline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saghul%2Fshline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saghul%2Fshline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saghul","download_url":"https://codeload.github.com/saghul/shline/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saghul%2Fshline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-10T01:46:51.809Z","updated_at":"2026-04-02T01:13:36.796Z","avatar_url":"https://github.com/saghul.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"A simple powerline style prompt for my bash shell\n=================================================\n\n![shline-example](https://raw.github.com/saghul/shline/master/example.png)\n\n# Overview\n\nThis is a simple powerline style shell line for myself. I use bash, so this project only\nsupports bash. If you like using another shell feel free to fork it (just as I did) and\nmodify it to your needs.\n\nThis project is a fork of [powerline-shell](https://github.com/milkbikis/powerline-shell)\ntailored to suit my needs. The original project seems to be unmaintained, with many issues\nand pull requests piling up. I also wanted something very simple, so you could say that\nshline is a subset of powerline-shell. It does have some additions though.\n\n\n# Segments\n\n* Shows some important details about the git/hg branch and darcs status:\n    * Displays the current branch which changes background color when the branch is dirty\n    * A '+' appears when untracked files are present\n    * When the local branch differs from the remote, the difference in number of commits is\n      shown along with '⇡' or '⇣' indicating whether a git push or pull is pending\n* Changes color if the last command exited with a failure code\n* If you're too deep into a directory tree, shortens the displayed path with an ellipsis\n* Shows the current Python [virtualenv](http://www.virtualenv.org/) environment\n* Multi-line prompts are supported\n* It's easy to customize and extend. See below for details.\n\n\n# Setup\n\nThis script uses ANSI color codes to display colors in a terminal. These are\nnotoriously non-portable, so may not work for you out of the box, but try\nsetting your $TERM to `xterm-256color`, because that works for me.\n\n* Install powerline's fonts by following the instructions [here](https://powerline.readthedocs.org/en/latest/installation.html#fonts-installation)\n\n  * If you struggle too much to get working fonts in your terminal, you can use the \"flat\" mode.\n\n* Clone this repository somewhere:\n\n        git clone https://github.com/saghul/shline\n\n* Copy `config.py.dist` to `config.py` and edit it to configure the segments you want. Then run\n\n        ./install.py\n\n* This will generate `~/.shline/shline.py`\n\n### Configuration:\n\nThere are a few optional arguments which can be seen by running `~/.shline/shline.py --help`.\n\n```\n  --cwd-max-depth CWD_MAX_DEPTH\n                        Maximum number of directories to show in path\n  --mode {patched,flat}\n                        The characters used to make separators between\n                        segments\n```\n\nAdd the following to your `.bashrc`:\n\n        function _update_ps1() {\n            local PREV_ERROR=$?\n            local JOBS=$(jobs -p | wc -l)\n            export PS1=\"$(python2.7 ~/.shline/shline.py --prev-error $PREV_ERROR --jobs $JOBS 2\u003e /dev/null)\"\n        }\n\n        export PROMPT_COMMAND=\"_update_ps1\"\n\n\nNote: Python 2 is needed, shline doesn't work with Python 3 yet.\n\n\n# Customization\n\n### Adding, Removing and Re-arranging segments\n\nThe `config.py` file defines which segments are drawn and in which order. Simply\ncomment out and rearrange segment names to get your desired arrangement. Every\ntime you change `config.py`, run `install.py`, which will generate a new\n`~/.shline/shline.py` customized to your configuration. You should see the new\nprompt immediately.\n\n### Adding new types of segments\n\nThe `segments` directory contains python scripts which are injected as is into\na single file `powerline-shell.py.template`. Each segment script defines a\nfunction that inserts one or more segments into the prompt. If you want to add a\nnew segment, simply create a new file in the segments directory and add its name\nto the `config.py` file at the appropriate location.\n\nMake sure that your script does not introduce new globals which might conflict\nwith other scripts. Your script should fail silently and run quickly in any\nscenario.\n\nMake sure you introduce new default colors in `themes/default.py` for every new\nsegment you create. Test your segment with this theme first.\n\n### Themes\n\nThe `themes` directory stores themes for your prompt, which are basically color\nvalues used by segments. The `default.py` defines a default theme which can be\nused standalone, and every other theme falls back to it if they miss colors for\nany segments. Create new themes by copying any other existing theme and\nchanging the values. To use a theme, set the `THEME` variable in `config.py` to\nthe name of your theme.\n\nA script for testing color combinations is provided at `themes/colortest.py`.\nNote that the colors you see may vary depending on your terminal. When designing\na theme, please test your theme on multiple terminals, especially with default\nsettings.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaghul%2Fshline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaghul%2Fshline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaghul%2Fshline/lists"}