| Crates.io | eliprompt |
| lib.rs | eliprompt |
| version | 0.4.0 |
| created_at | 2020-09-07 06:28:18.404578+00 |
| updated_at | 2024-01-22 06:11:23.462291+00 |
| description | Elegant and informative shell prompt |
| homepage | https://github.com/stephaneyfx/eliprompt |
| repository | https://github.com/stephaneyfx/eliprompt.git |
| max_upload_size | |
| id | 285620 |
| size | 89,883 |
CLI to generate a shell prompt.
The default prompt configuration uses symbols from Nerd Fonts and expects one of them to be installed.
Only zsh is supported. Please open an issue if support for another shell is desired.
cargo install eliprompt
Make sure eliprompt is in your PATH and add the following to .zshrc:
eval "$(eliprompt install --shell zsh)"
The prompt is made of blocks. Each block contains the text to display as well as the style (foreground and background colors).
The configuration is stored in ~/.config/eliprompt/config.json. It consists of a JSON object
of type Config. Config and the other JSON types involved are detailed below.
BlockProducer typeJSON object with a single field named after its type among:
ElapsedExitCodeGitHeadGitPathHostnameWorkingDirectoryUsernameNewlineSpaceTextExitStatusSymbolOrSequenceSeparatedStyledColor typeString with a CSS color name (e.g. "red") or a CSS sRGB color (e.g. "#ff1000").
Config typeRoot configuration object. JSON object with the following fields:
prompt [optional]:
BlockProduceralternative_prompt [optional]:
BlockProducer or null$TERM is linux or the environment variable
ELIPROMPT_ALTERNATIVE_PROMPT is defined.timeout [optional]:
DurationDuration typeString containing a duration with unit, e.g. "3s" for 3 seconds.
Elapsed typeShows the duration of the previous command. JSON object with the following fields:
style [optional]:
Styleprefix [optional]:
Stringthreshold [optional]:
DurationExitCode typeShows the exit code of the previous command if it was not zero. JSON object with the following fields:
style [optional]:
Styleprefix [optional]:
StringExitStatusSymbol typestyle [optional]:
Styleerror_style [optional]:
Stylecontents:
StringGitHead typeShows the current git branch. JSON object with the following fields:
style [optional]:
Styleprefix [optional]:
StringGitPath typeIf the current working directory is in a git repository, it is shown relative to the root of the repository. JSON object with the following fields:
style [optional]:
Styleprefix [optional]:
StringHostname typestyle [optional]:
Styleprefix [optional]:
StringNewline typeAdds a newline character.
Or typeList of BlockProducer items. Returns blocks from the first producer that
produces at least one block.
Separated typeseparator_style [optional]:
Styleseparator [optional]:
Stringproducers:
BlockProducer itemsSequence typeList of BlockProducer items. Returns blocks from all producers.
Space typeAdds a space character.
Style typeJSON object with the following fields:
Styled typestyle [optional]:
Styleproducer:
BlockProducerText typestyle [optional]:
Stylecontents:
StringUsername typestyle [optional]:
Styleprefix [optional]:
StringWorkingDirectory typeShows the current working directory. JSON object with the following fields:
style [optional]:
Stylehome_as_tilde [optional]:
boolprefix [optional]:
String{
"prompt": {
"Styled": {
"style": {
"foreground": "teal",
"background": "black"
},
"producer": {
"Sequence": [
{
"Separated": {
"separator_style": {},
"separator": " | ",
"producers": [
{
"Separated": {
"separator_style": {},
"separator": "@",
"producers": [
{
"Username": {
"style": {},
"prefix": ""
}
},
{
"Hostname": {
"style": {},
"prefix": ""
}
}
]
}
},
{
"Or": [
{
"GitPath": {
"style": {},
"prefix": ""
}
},
{
"WorkingDirectory": {
"style": {},
"home_as_tilde": true,
"prefix": ""
}
}
]
},
{
"GitHead": {
"style": {},
"prefix": ""
}
},
{
"Elapsed": {
"style": {},
"prefix": "祥",
"threshold": "2s"
}
},
{
"ExitCode": {
"style": {
"foreground": "crimson"
},
"prefix": ""
}
}
]
}
},
{
"Newline": null
},
{
"ExitStatusSymbol": {
"style": {
"foreground": "dodgerblue"
},
"error_style": {
"foreground": "crimson"
},
"contents": "→"
}
},
{
"Space": null
}
]
}
}
},
"alternative_prompt": {
"Styled": {
"style": {
"foreground": "teal"
},
"producer": {
"Sequence": [
{
"Separated": {
"separator_style": {},
"separator": " | ",
"producers": [
{
"Separated": {
"separator_style": {},
"separator": "@",
"producers": [
{
"Username": {
"style": {},
"prefix": ""
}
},
{
"Hostname": {
"style": {},
"prefix": ""
}
}
]
}
},
{
"WorkingDirectory": {
"style": {},
"home_as_tilde": true,
"prefix": ""
}
},
{
"Elapsed": {
"style": {},
"prefix": "",
"threshold": "2s"
}
},
{
"ExitCode": {
"style": {
"foreground": "crimson"
},
"prefix": ""
}
}
]
}
},
{
"Newline": null
},
{
"ExitStatusSymbol": {
"style": {
"foreground": "dodgerblue"
},
"error_style": {
"foreground": "crimson"
},
"contents": "→"
}
},
{
"Space": null
}
]
}
}
},
"timeout": "1s"
}
All contributions shall be licensed under the MIT license.
starship provides more blocks and supports more shells.