:art: Contextual fmt inspired by bootstrap color classes



Cfmt

Contextual fmt




It provides contextual formatting functions that have nearly identical usage of the fmt package. The ideas were borrowed from bootstrap's contextual color classes.

Installation

go get github.com/mingrammer/cfmt

Usage

package main

import (
    "log"

    "github.com/mingrammer/cfmt"
)

func main() {
    cfmt.Success("User was created successfully")
    cfmt.Infoln("Here are some candidates")
    cfmt.Warningf("%s is not valid integer value\n", "123a")
    log.Fatal(cfmt.Serrorf("Only numeric is allowed, got %s", "123.456a"))
}

cfmt output

Contextual functions

Note: cfmt.Errorf function does not do same things to fmt.Errorf, but to fmt.Printf with red colored text.

  • Success (Green)
    • Fsuccess, Fsuccessf, Fsuccessln
    • Success, Successf, Successln
    • Ssuccess, Ssuccessf, Ssuccessln
  • Info (Cyan)
    • Finfo, Finfof, Finfoln
    • Info, Infof, Infoln
    • Sinfo, Sinfof, Sinfoln
  • Warning (Yellow)
    • Fwarning, Fwarningf, Fwarningln
    • Warning, Warningf, Warningln
    • Swarning, Swarningf, Swarningln
  • Error (Red)
    • Ferror, Ferrorf, Ferrorln
    • Error, Errorf, Errorln
    • Serror, Serrorf, Serrorln

License

MIT

Owner
MinJae Kwon
🐳 Golang & Python. I love computer science, system design, and automate something 💕
MinJae Kwon
Similar Resources

Contextual Content Discovery Tool

Contextual Content Discovery Tool

Kiterunner Introduction For the longest of times, content discovery has been focused on finding files and folders. While this approach is effective fo

Dec 27, 2022

Automation Tool to auto generate markdown notes from online classes/talks/presentations.

Automation Tool to auto generate markdown notes from online classes/talks/presentations.

autonotes Automation tool to autocapture screenshots and join them with a supplied .srt or .txt file and output a notes file in markdown. Problem? Wat

Aug 29, 2021

Contextual information about your git projects, right on the command-line

Contextual information about your git projects, right on the command-line

gitty gitty is a smart little CLI helper for git projects, that shows you all the relevant issues, pull requests and changes at a quick glance. It cur

Jan 8, 2023

An excellent tool for converting json files to structs or classes in any programming language.

An excellent tool for converting json files to structs or classes in any programming language.

Explore Usage » Report Bug · Request Feature Table of Contents About The Project Supported Languages Getting Started Usage Parameters Set Up Your Own

Dec 10, 2022

Libruscord - Discord bot that downloads classes for a given day from the schedule in Librus

libruscord Bot który pozwala na pobranie zajęć na dzisiejszy dzień z terminarza

May 25, 2022

MPD client inspired by ncmpcpp written in GO with builtin cover art previews.

 MPD client inspired by ncmpcpp written in GO with builtin cover art previews.

goMP MPD client inspired by ncmpcpp written in GO demo.mp4 Roadmap Add Functionality to Sort out most played songs Add a config parser Image Previews

Jan 1, 2023

Same as fmt.Errorf but with stack trace.

Annotation with stack trace for go1.13 Go 1.13 contains support for error wrapping. Now you can add additional information to an error by wrapping it

Dec 25, 2020

A lightweight replacement for the standard fmt package, reduces binary size by roughly 400kb in a hello world

console This is a lightweight replacement for the fmt package, reduces the binary size by roughly 400kb in a hello world program. Please note: This pa

Nov 7, 2021

Translate your Go program into multiple languages with similar fmt.Sprintf format syntax.

Loafer-i18n Loafer-i18n is a Go package and a command that helps you translate Go programs into multiple languages. Supports pluralized strings with =

Dec 22, 2021

Linter for Go's fmt.Errorf message

wrapmsg wrapmsg is Go code linter. this enforces fmt.Errorf's message when you wrap error. Example // OK 👍🏻 if err := pkg.Cause(); err != nil { re

Dec 27, 2022

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go. Background The twelve-factor methodology has pro

Nov 3, 2022

Bootstrap a new project from a template.

Go Starter Go-starter allows to bootstrap a new project from a template. It uses Git repositories as templates and is shipped with batch of utilities

Oct 20, 2022

Bootstrap curated Kubernetes stacks. Logging, metrics, ingress and more - delivered with gitops.

Gimlet Stack Bootstrap curated Kubernetes stacks. Logging, metrics, ingress and more - delivered with gitops. You can install logging aggregators, met

Dec 1, 2021

A simple template using Fiber for me to bootstrap API services quickly.

Fiber Template A simple template using Fiber for me to bootstrap API services quickly. Features Fiber GORM air for hot reloading ... and possibly more

Dec 16, 2021

Use this template to bootstrap the creation of a Golang action

Create an Action using Golang Use this template to bootstrap the creation of a G

Dec 30, 2021

Decrypts and dumps K3s bootstrap data read from stdin.

k3s-dump-bootstrap Decrypts and dumps K3s bootstrap data read from stdin. Note: token parameter should be just the bare passphrase, not a full K10-f

Jan 12, 2022

Generates a simple skeleton directory structure for go/gin/bootstrap web apps

Gin Bootstrap Initializer Generates a simple skeleton directory structure for go/gin/bootstrap web apps Description This package handles building a co

Jan 21, 2022

:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go

:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go

Region quadtrees in Go Region quadtrees and efficient neighbour finding techniques in Go Go-rquad proposes various implementations of region quadtrees

Dec 13, 2022

3D line art engine.

3D line art engine.

ln The 3D Line Art Engine ln is a vector-based 3D renderer written in Go. It is used to produce 2D vector graphics (think SVGs) depicting 3D scenes. T

Dec 28, 2022
Comments
  • Use github.com/logrusorgru/aurora instead of github.com/fatih/color

    Use github.com/logrusorgru/aurora instead of github.com/fatih/color

    Fixed https://github.com/mingrammer/cfmt/issues/4

    Passed all the tests.

    $ git status
    ## use-aurora...origin/use-aurora
    $ go test ./...
    ok  	github.com/mingrammer/cfmt	(cached)
    

    Could you review it, please?

  • Align ln behaviour with fmt.Println

    Align ln behaviour with fmt.Println

    Example:

    cfmt.Successln("Initialized project at ", "location")
    // Terminal: Initialized project atlocation
    fmt.Println("Initialized project at ", "location")
    // Terminal: Initialized project at location
    
Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method

ctc - Console Text Colors The non-invasive cross-platform terminal color library does not need to modify the Print method Virtual unix-like environmen

Nov 9, 2022
Change the color of console text.

go-colortext package This is a package to change the color of the text and background in the console, working both under Windows and other systems. Un

Oct 26, 2022
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.

go-prompt A library for building powerful interactive prompts inspired by python-prompt-toolkit, making it easier to build cross-platform command line

Jan 3, 2023
Go-Generative-Art-A - Generate PNG art from source images! GOLang Generative Art
Go-Generative-Art-A - Generate PNG art from source images! GOLang Generative Art

GO Lang Generative Art Tool A Take source images and generate art utilizing sour

Nov 21, 2022
A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.
A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.

Maroto A Maroto way to create PDFs. Maroto is inspired in Bootstrap and uses Gofpdf. Fast and simple. Maroto definition: Brazilian expression, means a

Jan 7, 2023
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.

?? Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Dec 30, 2022
A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number)

go-c2dmc A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number). Implemented as

Jul 25, 2022
COCO (Color Converter) is a color conversion library for Go.

COCO (Color Converter) for Go COCO (Color Converter) is a color conversion library for Go. Heavily inspired by NPM's color-convert. It converts all wa

Oct 4, 2022
A pure Go contextual logging library with "batteries included"

Cue Overview Cue implements contextual logging with "batteries included". It has thorough test coverage and supports logging to stdout/stderr, file, s

Sep 16, 2019