Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 2.8 KB

Readme.md

File metadata and controls

109 lines (73 loc) · 2.8 KB

🎨 Rich-go

min go version

Rich-go is a Go library for printing text in terminal in a more readable and eye-pleasing way. This library is meant to be a Go equivalent of the Python library Rich by Textualize.

Note: This library is still in development and is not yet ready for production use.

🚀 Getting Started

Installation

To install Rich-go, you just need to go get it:

go get github.com/rvfet/rich-go

Usage

Rich-go aims to be as simple as possible to use. Here is a simple example:

package main

import (
  "github.com/rvfet/rich-go"
)

func main() {
  rich.Print("Hello, World!")
}

Output

Common logging functions are also available:

package main

import (
  "github.com/rvfet/rich-go"
)

func main() {
  rich.Info("Connecting to database...")
  rich.Warning("Connection timed out, retrying...")
  rich.Error("Connection failed!")
  rich.Success("Connection successfully established!")
  rich.Debug("Connection took 2.5s")
}

Output

Rich-go also supports inline styles, arguments and nesteding. Here's a crazy example:

package main

import (
  "github.com/rvfet/rich-go"
)

func main() {
	rich.Print("[x]Hello[/] [green][i]World[/] and its", 8, "[white]billion[/] [b]beautiful[/] [red]inhabitants[/]!")
	rich.Debug("This API [yellow]has to be[/yellow] [u]revised[/u] and [u]optimized[/u]!")
}

Output

Note: For icons to work, you need to have a font that supports them. You can use the Nerd Fonts for this.

For real-world usage example and quickly getting started, check out the Example code.

Output


📦 Roadmap

  • Basic text printing
  • Basic logging functions
  • Inline styles
  • Making Print and logging functions variadic
  • Handling nested styles in a better way
  • Implementing string formatting: rich.Print("Hello, %s!", name) or rich.Print("Hello, {name}!")
  • Making monkey-patching easier and improving modularity
  • Perhaps, a docs website?
  • Config file for customizing styles
  • Logging to file

🤝 Contributing

Contributions are always welcome! Feel free to open issues or pull requests.

📦 Built With

  • Go - The Go Programming Language And it's standard libraries.

📧 Contact

If you have any questions or suggestions, feel free to contact me at [email protected].