Rich command-line formater for vt100.
Go to file
xdrm-brackets 983d9746b6 fix progress rewrite : multiline vs. no newline at all 2019-01-30 21:32:06 +01:00
cmd/clifmt add executable -help explanation 2019-01-27 16:40:21 +01:00
internal minmod 2019-01-29 14:34:38 +01:00
README.md update readme: add hyperlink format 2019-01-27 17:04:45 +01:00
printer.go add progress (Printpf) featuring :\n (1) channel & normal arguments\n (2) right padding to avoid overlaps\n 2019-01-29 18:55:42 +01:00
printer_test.go add progress (Printpf) featuring :\n (1) channel & normal arguments\n (2) right padding to avoid overlaps\n 2019-01-29 18:55:42 +01:00
progress.go fix progress rewrite : multiline vs. no newline at all 2019-01-30 21:32:06 +01:00
util.go add progress (Printpf) featuring :\n (1) channel & normal arguments\n (2) right padding to avoid overlaps\n 2019-01-29 18:55:42 +01:00

README.md

| extended terminal format |

Go version Go Report Card Go doc buddy branch

Simple utility written in go that extends the standard fmt.Sprintf and fmt.Printf functions. It allows you to set foreground/background color, bold, underlined and italic text.


(1) Format

[Colorization]

Base format

${<target text>}(<fg>:<bg>)
  • <target text> is the text that will be colorized.

  • <fg> is the name of the foreground color (c.f. color list), or an hex color (e.g.#00ffaa, #0fa).

  • <bg> is the name of the background color with the same syntax as for the foreground.

Example
clifmt.Printf("normal text ${red text over black}(red:#000) normal text")

Note that it is not recommended to nest the different coloring formats.

Foreground only

${<target text>}(<fg>)
  • <target text> is the text that will be colorized.
  • <fg> is the name of the foreground color.
Example
clifmt.Printf("normal text ${red text}(red) normal text")

Background only

${<target text>}(:<bg>)
  • <target text> is the text that will be colorized.
  • <bg> is the name of the background color.
Example
clifmt.Printf("normal text ${text over red}(#ff0000) normal text")

[Markdown-like format]

Bold format

**<target text>**
  • <target text> is the text that will be bold.
Example
clifmt.Printf("normal text **bold text** normal text")

Italic format

*<target text>*
  • <target text> is the text that will be italic.
Example
clifmt.Printf("normal text *italic text* normal text")

Underline format

_<target text>_
  • <target text> is the text that will be underlined.
Example
clifmt.Printf("normal text _underline text_ normal text")
[<target text>](<target url>)
  • <target text> is the text that will be displayed.
  • <target url> is the url the hyperlink links to.
Example
clifmt.Printf("normal text [hyper](link) normal text")

(2) Screenshot

Colorizing format example :

colorizing example

Markdown-like format example

markdown-like example


(3) Incoming features

  • markdown-like formatting - bold, italic, underlined, (strike-through?)
  • global alignment - align text dynamically
  • progress-line - redrawing format to show, for instance an animated progress bar on the same line