|
1 |
| -<h1 align="center">Bash Prompt Generator</h1> |
| 1 | +# Bash Prompt Generator |
2 | 2 |
|
3 |
| -<p align="center"> |
4 |
| - <a href="./LICENSE" title="License"> |
5 |
| - <img src="https://img.shields.io/github/license/Scriptim/bash-prompt-generator"> |
6 |
| - </a> |
7 |
| - <a href="https://github.com/Scriptim/bash-prompt-generator/stargazers" title="GitHub Stars"> |
8 |
| - <img src="https://img.shields.io/github/stars/Scriptim/bash-prompt-generator?style=social"> |
9 |
| - </a> |
10 |
| - <a href="https://github.com/Scriptim/bash-prompt-generator/fork" title="Fork GitHub Repo"> |
11 |
| - <img src="https://img.shields.io/github/forks/Scriptim/bash-prompt-generator?style=social"> |
12 |
| - </a> |
13 |
| - <br><br> |
14 |
| - <b>Create a custom PS1 variable for your Bash.</b> |
15 |
| - <br><br> |
16 |
| - <a align="center" href="https://scriptim.github.io/bash-prompt-generator" title="Check It Out"> |
17 |
| - <img src="https://forthebadge.com/images/badges/check-it-out.svg"> |
18 |
| - </a> |
19 |
| -</p> |
| 3 | +**Create a custom PS1 variable for your Bash.** |
20 | 4 |
|
21 |
| -## Example |
| 5 | +[](https://github.com/Scriptim/bash-prompt-generator/stargazers "Stargazers") |
| 6 | +  |
| 7 | +[](https://github.com/Scriptim/bash-prompt-generator/fork "Forks") |
22 | 8 |
|
23 |
| - |
24 | 9 |
|
25 |
| -### Result |
| 10 | +<!-- badge generated using https://forthebadge.com/generator/ --> |
| 11 | +[](https://bash-prompt-generator.org "Check it out") |
26 | 12 |
|
27 |
| - |
| 13 | +## What is a Bash Prompt? |
28 | 14 |
|
29 |
| -## See also |
| 15 | +The prompt is a short piece of text that is displayed in the Bash shell prompting you to enter a command. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +It usually contains some useful information about the current user, the working directory, etc. |
| 20 | + |
| 21 | +## Where is the Prompt Configured? |
| 22 | + |
| 23 | +The `PS1` environment variable determines what information the prompt contains and how it is displayed. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +The default value may vary between different distributions and versions. |
| 28 | + |
| 29 | +Setting the `PS1` variable yourself (e. g. by appending the line `PS1='[\u@\h \w]\$ '` to your `~/.bashrc` file) allows you to customize your prompt. |
| 30 | + |
| 31 | +## How is the Prompt Configured? |
| 32 | + |
| 33 | +The syntax of the `PS1` variable allows versatile customization options. |
| 34 | +In addition to the information displayed, colors as well as other display attributes can be adjusted. |
| 35 | + |
| 36 | +However, this syntax is difficult to read by humans and manual customization is therefore extremely tedious. |
| 37 | + |
| 38 | +For this reason, this project provides a way to create a prompt via a GUI without having to modify the PS1 variable itself. |
| 39 | + |
| 40 | +### See also |
30 | 41 |
|
31 | 42 | - [GNU Bash Manual: Controlling the Prompt](https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html)
|
32 | 43 | - [ArchWiki: Bash/Prompt customization](https://wiki.archlinux.org/index.php/Bash/Prompt_customization)
|
33 | 44 |
|
| 45 | +## How to Use |
| 46 | + |
| 47 | +### Getting Started |
| 48 | + |
| 49 | +When you visit the [website](https://bash-prompt-generator.org) for the first time, you have the option to either create a new prompt from scratch or import your current prompt for adjustment. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +A prompt consists of multiple so-called *elements*. |
| 54 | +You can click on one of the elements on the left (*Prompt Elements*) to add it to your prompt. |
| 55 | +If you choose to import your existing prompt, paste the output of `echo $PS1` (e. g. `[\u@\h \w]\$ `) into the text field and the according elements will be automatically added to your prompt. |
| 56 | + |
| 57 | +### Your Prompt |
| 58 | + |
| 59 | +The *Your Prompt* sections lists all elements that are currently part of your prompt. |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +You can always add more elements from the *Prompt Elements* section on the left, reorder the elements in your prompt using drag and drop or remove them. |
| 64 | + |
| 65 | +The trash icon will remove all elements from your prompt, letting you start from scratch. |
| 66 | + |
| 67 | +The command for setting the `PS1` variable is displayed in the *Output* section, along with an example preview of how your prompt might look like. |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +The clipboard icon will copy the full command to your clipboard. |
| 72 | + |
| 73 | +If you run the generated command in your terminal, you will immediately see the changes to your prompt. |
| 74 | +These changes will be lost when you close your terminal, however. |
| 75 | +In order to make the changes permanent, you have to add the command to your `~/.bashrc` file. |
| 76 | + |
| 77 | +Note that the preview will most likely differ from the actual prompt in your terminal because the environment (such as the current user, hostname, etc.) is different. |
| 78 | + |
| 79 | +You can click on the lightbulb icon to toggle between a dark and a light background for the preview. |
| 80 | + |
| 81 | +### Properties |
| 82 | + |
| 83 | +All elements can be selected by clicking on them. |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +Depending on the type of the selected element, different properties can be adjusted. |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +Most elements support colors and various display attributes. |
| 92 | + |
| 93 | +Look at the example preview to see how these properties affect the prompt. |
| 94 | + |
| 95 | +Foreground and background colors can be choosen via a color picker. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +The color picker provides a *no color* option for resetting to the default color, 16 4-bit colors (top row) and 256 8-bit colors (bottom rows). |
| 100 | + |
| 101 | +Note that some terminals may not support all colors. |
| 102 | +The same applies to display attributes. |
| 103 | + |
| 104 | +Additionally, you can duplicate the selected element with the copy icon under *Actions*. |
| 105 | + |
| 106 | +#### Special Elements |
| 107 | + |
| 108 | +Some element types have special properties: |
| 109 | + |
| 110 | +* *Date (formatted)* requires a string specifying the date format which will be passed to [`strftime(3)`](https://linux.die.net/man/3/strftime "man 3 strftime"). |
| 111 | +* *Command* requires a string specifying the command to be executed. |
| 112 | +The prompt will contain the standard output of the command. |
| 113 | + * The *Git branch* and *IP Address* elements are functionally equivalent to a *Command* element with the command already filled in. |
| 114 | +* *Text* requires an arbitrary string that will be included as is in the prompt. |
| 115 | + |
34 | 116 | ## License
|
35 | 117 |
|
36 | 118 | Copyright (C) 2023 Scriptim
|
|
0 commit comments