~poldi1405/go-ansi

Write pretty terminal output the easy way.
dbffa8bb — Moritz Poldrack 2 years ago
expanded strip documentation
84cfcdee — Moritz Poldrack 2 years ago
updated README
6db2a890 — Moritz Poldrack 2 years ago
updated length to work with links and notifications

clone

read-only
https://git.sr.ht/~poldi1405/go-ansi
read/write
git@git.sr.ht:~poldi1405/go-ansi

You can also use your local clone with git send-email.

#go-ansi

Version License: MIT

import "mpldr.codes/ansi"

Write pretty terminal output the easy way.

Want your text green? ansi.Green("I am Shrek")

Want it black on a red ground? ansi.RedBG(ansi.Black("You can just combine them"))

Moving around is as simple as Specifying a direction ansi.Up()

#ANSI Support¹

  • movement
  • line operations (clearing lines)
  • fore- and background colour
  • formatting (bold, italic, strikethrough, …)
  • stripping ANSI-Codes
  • links (even to files)
  • notifications

¹) support depends on the terminal emulator used and configuration

#User Choice

This library implements the (informal) NO_COLOR standard. This disables all colour-related ANSI-Codes but does not restrict any other function (like cursor movement or formatting). If this behavior is unwanted please stay on version 1.3.0 or below.

#Bugs Reports & Feature Requests

Bug Reports and Feature Requests can be sent to the issue tracker or via email to ~poldi1405/issues@todo.sr.ht (possible without creating an account on Sourcehut).

#Patches

Want to improve it yourself? Awesome! Please send your patches to ~poldi1405/patches@lists.sr.ht (see submitted patches here).

For an easy quickstart, just run these commands:

$ git config format.subjectPrefix "PATCH go-ansi"
$ git config sendemail.to "~poldi1405/patches@lists.sr.ht"

Please sign-off your Commits to confirm the DCO.

#License

This library is licensed under the MIT License which can be found here.