Exploring Golang by re-implementing pure prompt.
ℹ️ This is a really basic and naive implementation.
-
Download the release binary for your OS/Arch
-
Allow execution
chmod u+x /path/to/pure
-
Try to execute manually
$ /path/to/pure -version --last-command-status $status # should print something like: ~/projects/contributions/pure.go 🐐go1.20.3 0 ❯
Edit $__fish_config_dir/functions/fish_prompt.fish
with:
function fish_prompt
/path/to/pure -version --last-command-status $status
end
PROMPT=$(/path/to/pure -version --last-command-status $status)
export PS1='$(/path/to/pure -version --last-command-status $status)'
❯ go run ./cmd/cli.go -version --last-command-status $status
or with the built binary
❯ make build
❯ ./pure --last-command-status $status
# or
❯ make demo
❯ make install
❯ make test
Create a pure
binary in the project's root directory.
❯ make build
❯ ./pure --last-command-status $status
- create a
pure
package- add
pure
package togo.mod
- add
pure
package togo.sum
- add
- print prompt
❯
withpure
package - test pure package output (with
testify
) - create a CLI (with
clîr
) - add current working directory to prompt
- add
go version
to prompt whengo.sum
exists - configure Goreleaser
- add color to output
- Original sindresorhus/pure Zsh implementation ;
- 🐟 pure-fish/pure Fish implementation (features rich) ;
- 🐍 edouard-lopez/pure.py Python implementation (partial features) ;
- 🐐 edouard-lopez/pure.go Golang implementation (partial features) ;
- ⚙️ xcambar/purs Rust implementation ;
- 🪟 nickcox/pure-pwsh PowerShell implementation.
- 🐚 krashikiworks/pure-prompt-bash Bash implementation.