Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edouard-lopez/pure.go
Exploring Golang by re-implementing pure prompt
https://github.com/edouard-lopez/pure.go
bash fish prompt pure shell zsh
Last synced: 5 days ago
JSON representation
Exploring Golang by re-implementing pure prompt
- Host: GitHub
- URL: https://github.com/edouard-lopez/pure.go
- Owner: edouard-lopez
- License: mit
- Created: 2023-08-23T13:31:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-30T13:41:55.000Z (9 months ago)
- Last Synced: 2024-10-11T10:21:59.269Z (28 days ago)
- Topics: bash, fish, prompt, pure, shell, zsh
- Language: Go
- Homepage:
- Size: 4.66 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pure.go 🐐 [![CI](https://github.com/edouard-lopez/pure.go/actions/workflows/ci.yml/badge.svg)](https://github.com/edouard-lopez/pure.go/actions/workflows/ci.yml)
> Exploring [Golang][go] by re-implementing [pure][pure] prompt.
>
> :information_source: This is a really basic and naive implementation.### Preview
![preview pure.go](./preview.png)
## Installation
1. Download the [release] binary for your OS/Arch
2. Allow execution```sh
chmod u+x /path/to/pure
```3. Try to execute manually
```sh
$ /path/to/pure -version --last-command-status $status
# should print something like:
~/projects/contributions/pure.go 🐐go1.20.3
0 ❯
```4. Edit your [Fish](#fish), [Zsh](#zsh) or [Bash](#bash) prompt (see below).
## Configuring Shell Prompt
### Fish
Edit `$__fish_config_dir/functions/fish_prompt.fish` with:
```fish
function fish_prompt
/path/to/pure -version --last-command-status $status
end
```### Zsh
```zsh
PROMPT=$(/path/to/pure -version --last-command-status $status)
```### Bash
```sh
export PS1='$(/path/to/pure -version --last-command-status $status)'
```## Development
### Usage
```sh
❯ go run ./cmd/cli.go -version --last-command-status $status
```or with the built binary
```sh
❯ make build
❯ ./pure --last-command-status $status
# or
❯ make demo
```### Install
```sh
❯ make install
```### Test
```sh
❯ make test
```## Build
Create a `pure` binary in the project's root directory.
```sh
❯ make build
❯ ./pure --last-command-status $status
```## Todo
* [x] create a `pure` package
* [x] add `pure` package to `go.mod`
* [x] add `pure` package to `go.sum`
* [x] print prompt `❯` with `pure` package
* [x] test pure package output (with [`testify`][test])
* [x] create a CLI (with [`clîr`][cli])
* [x] add current working directory to prompt
* [x] add `go version` to prompt when `go.sum` exists
* [x] configure Goreleaser
* [x] add color to output[test]: https://github.com/stretchr/testify/
[cli]: https://github.com/leaanthony/clir
[release]: https://github.com/edouard-lopez/pure.go/releases/
[pure]: https://github.com/pure-fish/pure/
[go]: go.dev/## Ports
* Original [sindresorhus/pure](https://github.com/sindresorhus/pure) Zsh implementation ;
* :fish: [pure-fish/pure](https://github.com/pure-fish/pure/) Fish implementation (features rich) ;
* :snake: [edouard-lopez/pure.py](https://github.com/edouard-lopez/pure.py/) Python implementation (partial features) ;
* :goat: [edouard-lopez/pure.go](https://github.com/edouard-lopez/pure.go/) Golang implementation (partial features) ;
* :gear: [xcambar/purs](https://github.com/xcambar/purs) Rust implementation ;
* :window: [nickcox/pure-pwsh](https://github.com/nickcox/pure-pwsh/) PowerShell implementation.
* :shell: [krashikiworks/pure-prompt-bash](https://github.com/krashikiworks/pure-prompt-bash) Bash implementation.