pure.go

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: MIT

README

pure.go 🐐

Exploring Golang by re-implementing pure prompt.

ℹ This is a really basic and naive implementation.

Preview

preview pure.go

Installation

  1. Download the release binary for your OS/Arch

  2. Allow execution

    chmod u+x /path/to/pure
    
  3. Try to execute manually

    $ /path/to/pure -version --last-command-status $status
    # should print something like:
    ~/projects/contributions/pure.go 🐐go1.20.3
    0 ❯
    
  4. Edit your Fish, Zsh or Bash prompt (see below).

Configuring Shell Prompt

Fish

Edit $__fish_config_dir/functions/fish_prompt.fish with:

function fish_prompt
    /path/to/pure -version --last-command-status $status
end
Zsh
PROMPT=$(/path/to/pure -version --last-command-status $status)
Bash
export PS1='$(/path/to/pure -version --last-command-status $status)'

Development

Usage
❯ 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
Install
❯ make install
Test
❯ make test

Build

Create a pure binary in the project's root directory.

❯ make build
❯ ./pure --last-command-status $status

Todo

  • create a pure package
    • add pure package to go.mod
    • add pure package to go.sum
  • print prompt with pure package
  • test pure package output (with testify)
  • create a CLI (with clîr)
  • add current working directory to prompt
  • add go version to prompt when go.sum exists
  • configure Goreleaser
  • add color to output

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL