Updated README
This commit is contained in:
parent
3ca299e14f
commit
264719da5e
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
@ -13,7 +13,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettyprompt"
|
name = "prettyprompt"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "prettyprompt"
|
name = "prettyprompt"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
76
README.md
76
README.md
@ -2,7 +2,81 @@
|
|||||||
|
|
||||||
A pretty shell prompt, written in rust
|
A pretty shell prompt, written in rust
|
||||||
|
|
||||||
|
## Current Features
|
||||||
|
|
||||||
|
- **User indicator** - Symbol with different colors for root user and normal users
|
||||||
|
- **Error indicator** - Symbol with different colors to indicate if the last comment was successful
|
||||||
|
- **Git repo indicator**
|
||||||
|
- Indicates if the current directory is a repo or a regular directory
|
||||||
|
- Branches indicated by different colors
|
||||||
|
- **SSH indicator** - Symbol to indicate if the current shell is in an SSH session
|
||||||
|
- **Current directory**
|
||||||
|
- Abbreviated if the path is too long
|
||||||
|
- Replaces the user's home directory with a `~` symbol
|
||||||
|
- Show the repo's name if currently in a git repo
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||
![screenshot](https://git.candifloss.cc/candifloss/PrettyPrompt/raw/branch/main/screenshot/BashPromptExampleScreenshoot.png "Screenshot")
|
![screenshot](https://git.candifloss.cc/candifloss/PrettyPrompt/raw/branch/main/screenshot/BashPromptExampleScreenshoot.png "Screenshot")
|
||||||
Ignore the zsh prompt in the screenshot.
|
|
||||||
|
## Planned Features
|
||||||
|
|
||||||
|
- Right-hand side prompt
|
||||||
|
- Configuration file
|
||||||
|
- Choose only the components you need
|
||||||
|
- Change appearance
|
||||||
|
- symbols and texts
|
||||||
|
- colors
|
||||||
|
- order and position
|
||||||
|
- Etc.
|
||||||
|
- User-defined components
|
||||||
|
- Static sybols or strings
|
||||||
|
- Shell symbol
|
||||||
|
- Host name
|
||||||
|
- Etc.
|
||||||
|
- Dynamic components by running custom commands
|
||||||
|
- Time & date
|
||||||
|
- More `git` information
|
||||||
|
- System stats
|
||||||
|
- Basically, anything you like
|
||||||
|
|
||||||
|
## Current Limitations
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
## 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 configuration depends on the shell and the configuration file location can vary according to your distro.
|
||||||
|
|
||||||
|
### `bash`
|
||||||
|
|
||||||
|
System-wide: `/etc/bash.bashrc` or User-specific: `$HOME/.bashrc`:
|
||||||
|
```bash
|
||||||
|
PS1="" // PS1 is a fixed prompt variable.
|
||||||
|
PROMPT_COMMAND="prettyprompt $?" // This updates the prompt every time.
|
||||||
|
```
|
||||||
|
|
||||||
|
### `ion`
|
||||||
|
|
||||||
|
User-specific: `$HOME/.config/ion/initrc`:
|
||||||
|
|
||||||
|
```ion
|
||||||
|
# This is currently the only way to customize the prompt according to the docs
|
||||||
|
fn PROMPT
|
||||||
|
prettyprompt $?
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changes since the last version
|
||||||
|
- **Updated Output String Type:** Improved compatibility with other shells.
|
||||||
|
- **Revamped Indicator Symbols:** Enhanced the visual aspect of the prompt.
|
||||||
|
- **Removed Shell Symbol:** Determining the shell is practically not possible.
|
||||||
|
- **Conditional Component Inclusion:** A first step towards user-configuration expected in future versions.
|
||||||
|
- **Code Improvements:** readability and performance
|
||||||
|
- **Refactoring:** Modular structure for better readability and maintenance.
|
||||||
|
- **Modularization:** Separate modules for cleaner organization.
|
||||||
|
- **Error Handling:** Improved logic to exclude error messages from the prompt.
|
||||||
|
- **Enhanced Documentation:** Comments for better comprehension.
|
||||||
|
|
||||||
|
@ -64,5 +64,6 @@ fn main() {
|
|||||||
|
|
||||||
// Finally, combine the parts into a single prompts string
|
// Finally, combine the parts into a single prompts string
|
||||||
let prompt: ANSIGenericStrings<'_, str> = ANSIGenericStrings(&components[..]);
|
let prompt: ANSIGenericStrings<'_, str> = ANSIGenericStrings(&components[..]);
|
||||||
print!("{prompt} "); // A trailing space for aesthetic formatting. `print!()` prevents an extra newline, unlike `println!()`
|
// `print!()` prevents an extra newline, unlike `println!()`
|
||||||
|
print!("{prompt} "); // A trailing space for aesthetic formatting.
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user