Modified README

This commit is contained in:
Candifloss 2024-11-30 16:47:36 +05:30
parent 264719da5e
commit 6766711122

View File

@ -21,7 +21,7 @@ A pretty shell prompt, written in rust
## Planned Features ## Planned Features
- Right-hand side prompt - Right-hand side prompt: Implementing this is a challenge on non-`zsh` shells
- Configuration file - Configuration file
- Choose only the components you need - Choose only the components you need
- Change appearance - Change appearance
@ -30,7 +30,7 @@ A pretty shell prompt, written in rust
- order and position - order and position
- Etc. - Etc.
- User-defined components - User-defined components
- Static sybols or strings - Static symbols or strings
- Shell symbol - Shell symbol
- Host name - Host name
- Etc. - Etc.
@ -45,30 +45,64 @@ A pretty shell prompt, written in rust
- Not user-configurable, yet - any changes in the current stage require hard-coding. - Not user-configurable, yet - any changes in the current stage require hard-coding.
- Exit code of the last command requires to be passed as a command-line argument. - Exit code of the last command requires to be passed as a command-line argument.
## Tested on
Ubuntu 24.04
- `bash` 5.2
- `zsh` 5.9
- `ion` 1.0.0-alpha
## Installation
1. Download the pre-built binary from [releases](https://git.candifloss.cc/candifloss/PrettyPrompt/releases), or build from source:
```bash
git clone https://git.candifloss.cc/candifloss/PrettyPrompt.git
cd PrettyPrompt/
cargo build --release #Now find the `prettyprompt` binary in `target/release/`
```
2. Move the binary to a path in your `$PATH`. Eg:
```bash
sudo mv /path/to/prettyprompt /usr/bin/
```
Or add it to your `$PATH` variable by adding this to your `bashrc`, `zshrc`, or `ion/initrc`
```bash
export PATH="$PATH:/your/path"
```
## Usage ## Usage
The binary needs to be in your `$PATH`. Place it somewhere like `/usr/bin/`, or add the appropriate path to the `$PATH` variable The binary needs to be in your `$PATH`. Place it somewhere like `/usr/bin/`, or add the appropriate path to the `$PATH` variable.
The configuration depends on the shell and the configuration file location can vary according to your distro. The configuration depends on the shell, and the file location can vary according to your distro. Please consult the documentations or forums of your shell for more accurate information.
### `bash` ### `bash`
System-wide: `/etc/bash.bashrc` or User-specific: `$HOME/.bashrc`: - The `PS1` variable sets a fixed prompt string.
- This `PROMPT_COMMAND` variable updates the prompt every time.
System-wide: `/etc/bash.bashrc`, or User-specific: `$HOME/.bashrc`:
```bash ```bash
PS1="" // PS1 is a fixed prompt variable. PS1="" # Set it to an empty string
PROMPT_COMMAND="prettyprompt $?" // This updates the prompt every time. PROMPT_COMMAND='prettyprompt $?' # Single quotes, not double quotes
``` ```
### `ion` ### `ion`
User-specific: `$HOME/.config/ion/initrc`: The `PROMPT` function is currently the only way to customize the prompt according to the ion shell docs.
User-specific config file: `$HOME/.config/ion/initrc`:
```ion ```ion
# This is currently the only way to customize the prompt according to the docs
fn PROMPT fn PROMPT
prettyprompt $? prettyprompt $?
end end
``` ```
### `zsh`
Export the `PS1` variable with the output of `prettyprompt $?` as its value.
User-specific: `$HOME/.zshrc`, System-wide: `/etc/zsh/zshrc`:
```zsh
export PS1='$(prettyprompt $?)'
```
## Changes since the last version ## Changes since the last version
- **Updated Output String Type:** Improved compatibility with other shells. - **Updated Output String Type:** Improved compatibility with other shells.
- **Revamped Indicator Symbols:** Enhanced the visual aspect of the prompt. - **Revamped Indicator Symbols:** Enhanced the visual aspect of the prompt.
@ -80,3 +114,6 @@ end
- **Error Handling:** Improved logic to exclude error messages from the prompt. - **Error Handling:** Improved logic to exclude error messages from the prompt.
- **Enhanced Documentation:** Comments for better comprehension. - **Enhanced Documentation:** Comments for better comprehension.
## Acknowledgement
The current default(and only) theme is inspired by [s1ck94](https://github.com/zimfw/s1ck94) theme from [zimfw](https://zimfw.sh/).