{"id":15042460,"url":"https://github.com/pocco81/mini-prompt","last_synced_at":"2025-04-14T20:46:48.751Z","repository":{"id":41572134,"uuid":"427830359","full_name":"pocco81/mini-prompt","owner":"pocco81","description":"🦊 Minimal and versatile bash prompt","archived":false,"fork":false,"pushed_at":"2021-11-22T14:41:33.000Z","size":128,"stargazers_count":40,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T13:08:53.164Z","etag":null,"topics":["bash-prompt","bash-script","minimal","prompt","shell-prompt","shellcheck"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pocco81.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-14T03:44:33.000Z","updated_at":"2024-10-25T21:21:17.000Z","dependencies_parsed_at":"2022-08-25T14:51:10.669Z","dependency_job_id":null,"html_url":"https://github.com/pocco81/mini-prompt","commit_stats":null,"previous_names":["pocco81/miniprompt"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocco81%2Fmini-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocco81%2Fmini-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocco81%2Fmini-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocco81%2Fmini-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pocco81","download_url":"https://codeload.github.com/pocco81/mini-prompt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223350541,"owners_count":17131248,"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-prompt","bash-script","minimal","prompt","shell-prompt","shellcheck"],"created_at":"2024-09-24T20:47:20.748Z","updated_at":"2024-11-08T07:04:36.167Z","avatar_url":"https://github.com/pocco81.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch2 align=\"center\"\u003e🦊 MiniPrompt!\u003c/h2\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eMinimal and versatile bash prompt\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Pocco81/MiniPrompt/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/Pocco81/MiniPrompt?colorA=2c2837\u0026colorB=b9c4e3\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/Pocco81/MiniPrompt/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/Pocco81/MiniPrompt?style=for-the-badge\u0026label=Release\u0026logo=github\u0026logoColor=eceff4\u0026colorA=2c2837\u0026colorB=e9a3da\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Pocco81/MiniPrompt/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/Pocco81/MiniPrompt?colorA=2c2837\u0026colorB=f6c29c\u0026style=for-the-badge\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Pocco81/MiniPrompt/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/Pocco81/MiniPrompt?colorA=2c2837\u0026colorB=ecbfbd\u0026style=for-the-badge\u0026logo=github\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\n\u003cdiv style=\"text-align: justify\"\u003e\nMiniPrompt is a minimal Bash prompt that aims to be as lightweight as possible while still being feature rich and user friendly enough to appeal to most users.\n\u003c/div\u003e\n\n## 🎁 Features\n\n-   Colored exit status\n-   Easily configurable\n-   Fully customizable: colors, symbols, the prompt itself, and more...\n-   Better history\n-   Better completion\n-   Directory colors support\n-   Trimming path\n-   Various extensions\n    -   Git\n    -   Kubernetes\n    -   SSH\n    -   IP address\n    -   WIFI\n    -   Package versions\n-   Extensions can be toggled on and off on the fly\n\n## 🤖 Usage\n\n### 📦 Installation\n\nMake sure you have the following programs installed in your system:\n\n-   GNU Make\n-   `git`\n-   `npm` (for the npm installer)\n-   General utilities like `grep`, `sed`, `awk`, ...\n-   A patched [Nerd Font](https://www.nerdfonts.com/) (optional)\n\n#### NPM\n\n```\n$ npm install --global miniprompt.sh\n```\n\n\u003e If it throws an error then run the command with `sudo`\n\n#### Manual\n\n```sh\n$ git clone git@github.com:Pocco81/MiniPrompt.git \u0026\u0026 cd MiniPrompt\n$ make install\n```\n\n\u003e Installs the prompt under your local bins: `~/.local/bin`. Make sure this directory is in your `$PATH`; if it's not, paste this into your `~/.bashrc`:\n\n```sh\nexport PATH=$PATH:\"$HOME/.local/bin\"\n```\n\n#### AUR\n\n```sh\n👷🛑 Under dev\n```\n\n### 🔧 Setup\n\nTwo things:\n\n1. Enable the prompt in your `~/.bashrc`\n2. Configure it\n\nTo enable the prompt paste this into your `~/.bashrc`:\n\n```sh\nalias mp=\"source miniprompt\"\nmp\n```\n\nAfter that, feel free to customize the prompt to your like using the `conf.toml` file (located under `${XDG_CONFIG_HOME}/miniprompt/conf.toml`. If the `$XDG_CONFIG_HOME` env var is not set then it'll be assumed to be `$HOME/.config/`).\n\nHere is the [default config](https://github.com/Pocco81/MiniPrompt/blob/main/config/conf.toml):\n\n```toml\n# MiniPrompt's config file\n[behaviour]\ncolored_exit_status = true\t\t\t# prettify the exit status of the previous command\ndirtrim = 2\t\t\t# trim the CWD to only show x number of dirs\nenhanced_autocompletion = true\t\t\t# completion maps, tilde expansion, mark directories, ...\nenhanced_history_format = true\t\t\t# better format for your shell history: [%Y-%m-%d %T]\ndircolors = true\t\t\t# color directories\n\n[primary_prompt]\nprefix = \"\\[\\e]0;\\w\\a\\]\"\t\t\t# prompt prefix\nps_content = \"\u003c/yellow\u003e\\w\u003c/nc\u003e \"\t\t\t# the actual content of your prompt\nps_suffix = \"\u003c/green\u003e➜\u003c/nc\u003e \"\t\t# after the ps_content\nnormal_color = \"nc\"\t\t\t# the color text is defaulted to\nerror_symbol = \"✗\"\t\t\t# symbol to use after the previous command failed\nfailed = \"red\"\t\t\t# $error_mark's color after the previous command executed successfully\n\n[extensions]\next_git = false\t\t\t# enable git extension (shows current working branch)\next_ssh = false\t\t\t# enable ssh expansion (shows \u003cuser\u003e@\u003cmachine\u003e)\next_package = false\t\t\t# enable package expansion (shows project's current version)\next_kubernetes = false\t\t\t# enable kubernetes extension (shows kubernetes' current context)\next_ip = false\t\t\t# enable kubernetes extension (shows kubernetes' current context)\next_wifi = false\ngit_struct = \"\u003c/cyan\u003e \u003c/unit\u003e \"\t\t# structure of the integration\nssh_struct = \"\u003c/magenta\u003e \u003c/unit\u003e \" # structure of the integration\npackage_struct = \"\u003c/white\u003e v\u003c/unit\u003e \" # structure of the integration\nip_struct = \"\u003c/gray_br\u003e  \u003c/unit\u003e \" # structure of the integration\nwifi_struct = \"\u003c/blue\u003e直 \u003c/unit\u003e \" # structure of the integration\nhierarchy = \"ssh, git, ip, wifi, package\" # order in which the extensions are displayed\n```\n\n#### Customizing!\n\n##### Showcase\n\n![image](https://user-images.githubusercontent.com/58336662/142748343-c38a4b4b-82e7-4f95-a8c3-5bddda66fe5a.png)\n\n```\nps_content = \"\u003c/yellow_it\u003e\\w \u003c/blue_re\u003e \\@ \\n\u003c/magenta\u003e \\u\u003c/nc\u003e \"\n```\n\n![image](https://user-images.githubusercontent.com/58336662/142749510-735b7e06-6495-409c-97e8-b97c14fdc20d.png)\n\n```\nps_content = \"\u003c/magenta\u003e\u003c/magenta_re\u003e\\A \u003c/cyan_re\u003e \\w\u003c/cyan\u003e\u003c/nc\u003e \"\nps_suffix = \"\u003c/blue\u003e\u003c/nc\u003e \"\t\t# after the ps_content\n```\n\n![image](https://user-images.githubusercontent.com/58336662/142773041-24c0ecc1-f757-4cfa-941f-f5f355429379.png)\n\n```sh\n[primary_prompt]\nps_content = \"\u003c/yellow\u003e\\w\u003c/nc\u003e \"\t\t\t# the actual content of your prompt\nps_suffix = \"\\n\u003c/green\u003e➜\u003c/nc\u003e \"\t\t# after the ps_content\n\n[extensions]\ngit_struct = \"\u003c/cyan\u003e\u003c/cyan_re\u003e \u003c/unit\u003e\u003c/cyan\u003e \"\t\t# structure of the integration\npackage_struct = \"\u003c/white\u003e\u003c/white_re\u003e v\u003c/unit\u003e\u003c/white\u003e \" # structure of the integration\n```\n\n##### Prompt\n\nThe prompt itself can be changed modifying the `ps_content` and `ps_suffix` variables. Apart from giving your prompt different colors using the [tags](#tags), you can also modify the information displayed using the following built-in Bash options:\n\n| Opts         | Description                                             |\n| ------------ | ------------------------------------------------------- |\n| `\\a`         | A bell character                                        |\n| `\\d`         | Date (day/month/date)                                   |\n| `\\D{format}` | Date but following the system's time format             |\n| `\\e`         | Escape character                                        |\n| `\\h`         | Hostname (short)                                        |\n| `\\H`         | Full hostname (domain name)                             |\n| `\\j`         | Number of jobs being managed by the shell               |\n| `\\l`         | The basename of the shells terminal device              |\n| `\\n`         | New line                                                |\n| `\\r`         | Carriage return                                         |\n| `\\s`         | The name of the shell                                   |\n| `\\t`         | Time (hour:minute:second)                               |\n| `\\@`         | Time, 12-hour AM/PM                                     |\n| `\\A`         | Time, 24-hour, without seconds                          |\n| `\\u`         | Current username                                        |\n| `\\v`         | BASH version                                            |\n| `\\V`         | Extra information about the BASH version                |\n| `\\w`         | Current working directory                               |\n| `\\W`         | The basename of the working directory                   |\n| `\\!`         | Lists this command’s number in the history              |\n| `\\#`         | This command’s command number                           |\n| `\\$`         | Specifies whether the user is root (#) or otherwise ($) |\n| `\\\\`         | Backslash                                               |\n| `\\[`         | Start a sequence of non-displayed characters            |\n| `\\]`         | Close or end a sequence of non-displayed characters     |\n\n##### Structs\n\nStructs define the structure of the extensions. You can use tags to customize the structs further. However, there is an additional tag called `\u003c/unit\u003e`, which is the output of the extension. Say you are using the git extension:\n\n```sh\ngit_struct = \"\u003c/cyan\u003e \u003c/unit\u003e \"\n```\n\nThis will display:\n\n```sh\n dev\n```\n\nBecause `\u003c/unit\u003e`, in this case, displays the current working branch.\n\n##### Tags\n\n| Tag          | Description                            |\n| ------------ | -------------------------------------- |\n| `\u003c/gray\u003e`    | Makes text following it gray           |\n| `\u003c/red\u003e`     | Makes text following it red            |\n| `\u003c/green\u003e`   | Makes text following it green          |\n| `\u003c/blue\u003e`    | Makes text following it blue           |\n| `\u003c/cyan\u003e`    | Makes text following it cyan           |\n| `\u003c/yellow\u003e`  | Makes text following it yellow         |\n| `\u003c/magenta\u003e` | Makes text following it magenta        |\n| `\u003c/white\u003e`   | Makes text following it white          |\n| `\u003c/nc\u003e`      | Removes the color of text following it |\n\nYou can also give some properties to the colors by using modifiers and appending them at the end of the color (e.g. `\u003cgreen_br\u003e`):\n\n| Modifier | Description |\n| -------- | ----------- |\n| `_br`    | bright      |\n| `_dm`    | dim         |\n| `_it`    | italic      |\n| `_un`    | underlined  |\n| `_bl`    | blinking    |\n| `_re`    | inverted    |\n\n### 🌿 Utilization\n\n#### On the fly commands\n\nOn the previous step we created the alias `mp`, which we will be using to run commands for MiniPrompt. Use `mp --help` to see the available commands. Here is a quick example enabling the Git extension:\n\n```sh\n$ mp git enable\n# you can shorten it as: mp gt e\n```\n\n#### Reloading the prompt\n\nAfter changing the config file you can reload the prompt using the same alias, but without any flags:\n\n```sh\n$ mp\n```\n\n#### Dependencies for extensions\n\n| Extension | Dependencies |\n| --------- | ------------ |\n| Git       | `git`        |\n| SSH       | `openssh`    |\n| Package   | `npm`        |\n| Wifi      | `nmcli`      |\n| IP        | `ip`         |\n\n## 🙋 FAQ\n\n-   Q: **_\"If I don't have a config file, will MiniPrompt create one for me?\"_**\n-   A: No, settings will simply be assumed from default values.\n\n-   Q: **_\"Why does the alias created for the prompt needs to be sourced?\"_**\n-   A: Because you can't export env vars from a shell script unless it's sourced, so [this](https://stackoverflow.com/questions/16618071/can-i-export-a-variable-to-the-environment-from-a-bash-script-without-sourcing-i) is the best solution.\n\n## 📜 License\n\nMiniPrompt is released under the GPL v3.0 license. It grants open-source permissions for users including:\n\n-   The right to download and run the software freely\n-   The right to make changes to the software as desired\n-   The right to redistribute copies of the software\n-   The right to modify and distribute copies of new versions of the software\n\nFor more convoluted language, see the [LICENSE file](https://github.com/Pocco81/MiniPrompt/blob/main/README.md).\n\n# 📋 TO-DO\n\n**High Priority:**\n\n-   Publish to the AUR?\n\n**Low Priority:**\n\n-   None\n\n\u003chr\u003e\n\u003cp align=\"center\"\u003e\n\tEnjoy!\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocco81%2Fmini-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpocco81%2Fmini-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocco81%2Fmini-prompt/lists"}