• Stars
    star
    303
  • Rank 137,655 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 2 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a minimalist beautiful Go print (fmt alternative)

Cute Print

A cute Go print package (fmt alternative), Minimalist, No dependencies!

Support me to be an independent open-source programmer 💟

ko-fi

Installation

go get github.com/zakaria-chahboun/cute

The idea is to simplify the printing of messages in the terminal, especially in error case. Letting you to put a title for your message in different colors.

Print line

cute.Println("Hi everyone", "My name is", "Zakaria!")

print line

As you see the default color for the title is bright yellow and for the message is bright purple.

Print muti-lines

cute.Printlns("Hi everyone", "My name is Zakaria!", "Zaki is my nick name.")

print multi-lines

Check errors

The cute.Check(..) is useful in case of errors, especially if you have a lot of functions in you code. It will help you to print a clear error code.

// equal to (if error != nil)
cute.Check("Error Title", errors.New("This is a cute panic!"))

check errors

Change colors

You can change the color:

  • ResetColor

  • DefaultColor

  • Black / BrightBlack

  • Red / BrightRed

  • Yellow / BrightYellow

  • Green / BrightGreen

  • Blue / BrightBlue

  • Purple / BrightPurple

  • Cyan / BrightCyan

  • White / BrightWhite

cute.SetTitleColor(cute.BrightBlue)
cute.SetMessageColor(cute.BrightGreen)
cute.Println("Hi everyone", "My name is Zakaria!")

colors

Printf

cute.Printf("Another title", "%s, a Country in North Africa.\n", "Morocco")

printf

List

You can print a list of lines dynamically! You can also specify the color for each line:

// juice recipe 🧃
list := cute.NewList(cute.BrightBlue, "Yummy Juice!")
list.Add(cute.BrightGreen, "1 avocado 🥑")
list.Add(cute.BrightRed, "4 strawberry 🍓")
list.Addf(cute.White, "%d ML %s", 500, "milk 🥛")
list.Print()

print list with colors

How you can use it with Scan?

This is a little example:

cute.Printf("How old are you?", "")

var age int
_, err := fmt.Scanln(&age)
cute.Check("Error scan", err)

cute.Println("Info", "Your age is:", age)

use cute with Scan

Unicode in title box

We supported also a lot of languages and emojis!

// arabic
cute.Println("﴾ الله خالِقُ كُلِّ شيء ﴿")
// french
cute.Println("délicieux pain français")
// spanish
cute.Println("¡Hola! español")
// german
cute.Println("ich möchte Kaffee")
// chinese (simplified)
cute.Println("中国的长城")
// chinese (traditional)
cute.Println("中國的長城")
// japanese (hiragana)
cute.Println("進撃の巨人 すばらしい")
// russian
cute.Println("русская литература")
// turkish
cute.Println("türk şarküteri")
// korean
cute.Println("한국라면 맛있다")
// hindi (devanagari)
cute.Println("मसालों की भूमि")
// emoji
cute.Println("✅  🚀")
// complex
cute.Println("sweet | sucré | süß | 甜的 | 甘い | मीठा | حلو | 🍬")

support unicode

Real example

Tarjem is used our cute package, Here are some examples:

real example

Contribute 💟

Feel free to contribute or propose a feature or share your idea with us!


If you are using cute in your project please share that with us 😍 Twitter: @Zaki_Chahboun