https://github.com/info-mono/diyship
🧰🚀 Cross-shell prompt framework
https://github.com/info-mono/diyship
cli cross-shell diyship prompt starship terminal
Last synced: 8 months ago
JSON representation
🧰🚀 Cross-shell prompt framework
- Host: GitHub
- URL: https://github.com/info-mono/diyship
- Owner: info-mono
- License: gpl-3.0
- Created: 2021-05-08T15:03:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-05T08:11:44.000Z (about 3 years ago)
- Last Synced: 2025-01-06T05:25:37.061Z (9 months ago)
- Topics: cli, cross-shell, diyship, prompt, starship, terminal
- Homepage:
- Size: 103 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Cross-shell prompt framework
## 💡 About
**DIYship** is a cross-shell prompt framework that let you write your prompt with any programing language for any shell.
> [Learn more about how its work](#%EF%B8%8F-configuration).
## 🚀 Setup
### 📥 Installation
To install DIYship to your shell, simply append the correspond code file on this repo to your shell config file.
#### 🐚 Bash
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/bash >> ~/.bashrc
```#### 🐚 Zsh
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/zshrc >> ~/.zshrc
```#### 🐚 Fish
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/fish >> ~/.config/fish/config.fish
```#### 🐚 PowerShell
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/powerShell >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1
```#### 🐚 Ion
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/ion >> ~/.config/ion/initrc
```#### 🐚 Elvish
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/elvish >> ~/.elvish/rc.elv
```> **Warning** Only Elvish v0.18 or higher is supported.
#### 🐚 Tcsh
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/tcsh >> ~/.tcshrc
```#### 🐚 Nushell
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/nushell >> ~/.config/nu/config.toml
```#### 🐚 Xonsh
```sh
curl https://raw.githubusercontent.com/info-mono/diyship/main/xonsh >> ~/.xonshrc
```> **Warning** Only Nushell version v0.33 or higher is supported.
### ⚙️ Configuration
DIYship is basically execute a command (which could be a path to an executable script file or program) and take it output as a prompt,
you can change the command through variable:| Environment variable | Description |
| ----------------------- | ------------------------------ |
| `DIYSHIP_COMMAND_LEFT` | Command to print left prompt. |
| `DIYSHIP_COMMAND_RIGHT` | Command to print right prompt. |> **Note** You can disable right prompt by `DIYSHIP_COMMAND_RIGHT="test"`
DIYship will export these following environment variables before running the commands to print out prompts,
so you could utilize theme informations in your script/program:| Environment variable | Description |
| --------------------- | ------------------------------------------------------------- |
| `$DIYSHIP_SHELL` | Current shell name. |
| `$DIYSHIP_STATUS` | The status code of the previously run command. |
| `$DIYSHIP_PIPESTATUS` | Status codes from a command pipeline. |
| `$DIYSHIP_DURATION` | The execution duration of the last command (in milliseconds). |
| `$DIYSHIP_JOBS` | The number of currently running jobs |
| `$DIYSHIP_KEYMAP` | The current keymap. |Do to many technical limitation, not every shell support all features:
| Feature | Bash | Zsh | Fish | Powershell | Ion | Elvish | Tcsh | Nushell | Xonsh |
| -------------------- | ---- | --- | ---- | ---------- | --- | ------ | ---- | ------- | ----- |
| Left prompt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Right prompt | | ✅ | ✅ | | | ✅ | | | ✅ |
| Export current shell | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Export status | ✅ | ✅ | ✅ | ✅ | ✅ | | ✅ | | ✅ |
| Export pipe status | ✅ | ✅ | ✅ | | | | | | |
| Export duration | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Export jobs | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | ✅ |
| Export keymap | | ✅ | ✅ | | | | | | |> **Note** For more documentation and inspiration about writing your own prompt, checkout [ours wiki](https://github.com/info-mono/diyship/wiki) and [Starship's custom modules](https://github.com/starship/starship/discussions/1252).
## 💌 Credits
This project was heavily based on and inspired by [**Starship**](https://starship.rs).
---
>
Made with ❤️ by
@info-mono
>
>