Skip to content

sarkarshuvojit/pprinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pprinter

Minimal utility package to print user friendly messages to the console.

Can be used as an alternative to fmt.Println while printing messages from your CLI tool.

Features

  • Minimal API
  • Single dependency on charmbracelet/lipgloss
  • Supports color schemes
  • 10 inbuilt themes
  • Support for custom themes
  • Other utilities to print animated lines (like a progress bar)

Installation

Install from pkg.go.dev

go get github.com/sarkarshuvojit/pprinter

Usage/Examples

Simply import the package and intialise with a predefined theme & a custom theme of your own.

Then you can call the underlying methods.

package main

import (
	"fmt"
	"strings"

	"github.com/sarkarshuvojit/pprinter/pprinter"
)

func main() {
    pp := pprinter.WithTheme(pprinter.PastelTheme)
    p.Info("Test")
    p.Success("Test")
    p.Warning("Test")
    p.Error("Test")
}

Which would yeild the following output

asciicast

Other Examples

Themes Example

asciicast

Animated Text Example

asciicast