{"id":42924182,"url":"https://github.com/ghetzel/command-deck","last_synced_at":"2026-01-30T18:05:57.096Z","repository":{"id":144232005,"uuid":"173497180","full_name":"ghetzel/command-deck","owner":"ghetzel","description":"A Powerline-inspired PS1 terminal prompt generator.","archived":false,"fork":false,"pushed_at":"2023-02-18T19:23:16.000Z","size":194,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T11:10:35.548Z","etag":null,"topics":["bash","i3-wm","prompt","ps1","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghetzel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-03-02T20:46:34.000Z","updated_at":"2023-02-18T21:18:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"1574a1eb-deec-4255-a465-f892daa92494","html_url":"https://github.com/ghetzel/command-deck","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ghetzel/command-deck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghetzel%2Fcommand-deck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghetzel%2Fcommand-deck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghetzel%2Fcommand-deck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghetzel%2Fcommand-deck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghetzel","download_url":"https://codeload.github.com/ghetzel/command-deck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghetzel%2Fcommand-deck/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28917033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["bash","i3-wm","prompt","ps1","terminal"],"created_at":"2026-01-30T18:05:57.040Z","updated_at":"2026-01-30T18:05:57.091Z","avatar_url":"https://github.com/ghetzel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CommandDeck Demo](contrib/logo-tagline.png?raw=true)\n\n# Overview\n\nCommand Deck is a simple utility inspired by [Powerline](https://github.com/powerline/powerline) for creating simple, customizable terminal prompts that take advantage of Unicode and high-color terminal environments to create functional, beautiful, and data-rich command prompts.\n\n# Examples\n\n![Sample prompts](contrib/demo.png?raw=true)\n\n\n# Installation\n\nRetrieve the program using Golang's `go get` utility:\n\n`go get github.com/ghetzel/command-deck`\n\nAnd add the following to the end of your `~/.bashrc` file:\n\n```bash\nif which cdeck 2\u003e\u00261 \u003e /dev/null; then\n    PROMPT_COMMAND='export LASTEXIT=$?; PS1=$(LASTEXIT=$LASTEXIT cdeck)'\nfi\n```\n\nNote that `$LASTEXIT` is not special in any way.  We capture the last exit status via `$?` and store it in this variable, which is explicitly referenced in the configuration file.  If you don't need to get the last exit status, you can simply use `PROMPT_COMMAND='PS1=$(cdeck)'` instead.\n\n### \"How do I get that cool looking chevron separator?\"\n\nThe \"chevron\" is actually a custom full-height character stored in the Private Use Area of pre-modified fonts.  You can find the fonts Powerline uses here: https://github.com/powerline/fonts.  The examples shown here are using _DejaVu Sans Mono for Powerline (Book)_.\n\n# Usage\n\nCommandDeck is configured in two ways: via positional arguments in _eval_ mode (using the `--eval`/`-e` flag), or via a YAML configuration file located at `~/.config/cdeck.yml`.\n\n## Expressions\n\nExpressions allow for external commands to be evaluated for the purpose of using their output while building prompt segments.  Expressions are strings that contain literal text and _command substitutions_, which are surrounded by `{!` and `!}`.  When a command substitution is encountered, the command specified will be run and its standard output will be used in place of the substitution.  For example, the expression `Hello, {! whoami !}!` would expand to \"Hello, ghetzel!\".\n\n## Config File\n\nA configuration file is used to specify the individual segments that make up the CommandDeck output.  Expressions are accepted in the `fg`, `bg`, `if`, `except`, and `expr` fields.  This sample configuration file shows the options that produced the example prompt above:\n\n```yaml\nsegments:\n# Will output the value of the `$LASTEXIT` environment variable with a background color of red and\n# a foreground color of *bold* white (ANSI color #15 + \"b\" for bold), but only if the command `test\n# ${LASTEXIT}\" -ne 0` exits with status 0.\n-   name:    lastexit\n    bg:      red\n    fg:      '15+b'\n    if:      'test \"${LASTEXIT}\" -ne 0'\n    expr:    '{! echo \"${LASTEXIT:-?}\" !}'\n\n# Output the current HH:MM:SS time by executing `date +%H:%M:%S`.  Foreground is grey (ANSI #252,\n# \"Grey82\"), background is darker grey (ANSI #240, \"Grey35\").\n-   name:    time\n    fg:      252\n    bg:      240\n    expr:    \"{! date +%H:%M:%S !}\"\n\n# Output the current username and hostname as \"user@host\" by running `whoami` and `hostname -s`\n# (respectively).  Foreground is white (ANSI #15), background is selected on-the-fly by reading `~/\n# .ps1hostcolor`, and falling back to navy blue (ANSI #4).\n-   name:    user\n    fg:      15\n    bg:      '{! cat ~/.ps1hostcolor || echo 4 !}'\n    expr:    \"{! whoami !}@{! hostname -s !}\"\n\n# Output the current directory as returned from `pwd`, substiuting the first occurrence of the\n# string contained in `${HOME}` with a tilde (~).  Foreground is white, background is chartreuse\n# (ANSI #64, \"Chartreuse4\").\n-   name:    path\n    fg:      15\n    bg:      64\n    expr:    '{! pwd | sed \"s|${HOME}|~|\" !}'\n\n# Conditionally output a segment showing the current Git branch.  Foreground is white, background\n# is determined by the exit status of `test -z \"$(git status -s)\"`.  If it exits successfully,\n# there are no modified files in the current repository and the background color will be ANSI #24\n# (DeepSkyBlue4).  If the command exits non-zero, there _are_ uncommitted changes and the\n# background will be ANSI #9 (Red).  The commands must exit within 250ms or the segment will not be\n# shown.  This is a protection measure against terminal slowdown caused by entering large,\n# unindexed Git repositories.\n-   name:    git\n    if:      'git rev-parse --abbrev-ref HEAD'\n    fg:      15\n    bg:      '{! test -z \"$(git status -s)\" \u0026\u0026 echo 24 || echo 9 !}'\n    expr:    \"{! git rev-parse --abbrev-ref HEAD !}\"\n    timeout: 250ms\n```\n\n## Command Line (Eval Mode)\n\nYou can also invoke CommandDeck to print one-off evaluations for various purposes.  This approach is useful in a wide variety of circumstances that use text formatted inputs for various purposed (for example, the [i3 window manager's](https://i3wm.org/docs/userguide.html#_configuring_i3bar) `i3-bar` project could be configured this way.)\n\n#### Invocation\n\n```bash\ncdeck -e -T ' ' -s '|' \\\n    '::MEM {! free -w -g -h | grep \"^Mem\" | tr -s \" \" | cut -d\" \" -f8 !}' \\\n    \"::CPU {! echo $(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 )) !}$(printf '\\u00B0')C\" \\\n    \"::LOAD {! cat /proc/loadavg | cut -d' ' -f1-3 !}\" \\\n    \"::{! date '+%Y-%m-%d %H:%M:%S' !}\"\n```\n\n#### Output\n\n```\n MEM 8.6G | CPU 39°C | LOAD 0.61 0.40 0.32 | 2006-01-02 15:04:05\n```\n\nEach positional parameter is specified as a \"foreground:background:expression\" triple.  If either the foreground or background is omitted, the default color for the terminal will be used.  The expression is interpreted the same way as expressions in the config file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghetzel%2Fcommand-deck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghetzel%2Fcommand-deck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghetzel%2Fcommand-deck/lists"}