gosplash

Go library to make initial log lines at a program start time

MIT License

Stars
5

GoSplash

Library to show log lines at the start of a program

==================================================
==================================================
==================== gosplash ====================
==================================================
================ Made with ❤️ by =================
============ https://github.com/qdm12 ============
==================================================
==================================================

Running version v1.1.1 built on 2021-07-14 (commit c892ef2)

📣 hello world

🔧 Need help? ☕ Discussion? https://github.com/qdm12/gosplash/discussions/new/choose
🐛 Bug? ✨ New feature? https://github.com/qdm12/gosplash/issues/new/choose
💻 Email? [email protected]
💰 Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12

Features

  • Tailored towards Github repositories for now, create an issue if you need something

  • Wide range of optional settings available:

    type Settings struct {
      // Formatting settings
      Format       Format // defaults to DefaultFormat
      LineLength   int    // defaults to 40
      Separator    rune   // defaults to '='
      MadeByPrefix string // defaults to "Made with ❤️  by "
    
      // Project information
      RootURL    string // defaults to https://github.com
      User       string
      Repository string
      Authors    []string // defaults to [RootURL + "/" + User]
      Emails     []string
    
      // Program information
      Version      string // defaults to "unknown"
      Commit       string // defaults to "unknown"
      Created      string // defaults to "unknown date"
      Announcement string
      AnnounceExp  time.Time // leave to zero value to disable expiration
    
      // Sponsor information
      PaypalUser    string
      GithubSponsor string
    }
    
  • Support for emojis

  • 100% test coverage

Setup

go get github.com/qdm12/gosplash

From the example:

package main

import (
    "fmt"
    "strings"

    "github.com/qdm12/gosplash"
)

var (
    // should be set by your CI using -ldflags
    version = "v0.1.0"
    commit  = "c892ef2"
    date    = "2021-07-14"
)

func main() {
    lines := gosplash.MakeLines(gosplash.Settings{
        User:          "qdm12",
        Repository:    "gosplash",
        Version:       version,
        Commit:        commit,
        Created:       date,
        Announcement:  "new feature 🎉",
        PaypalUser:    "qmcgaw",
        GithubSponsor: "qdm12",
    })

    fmt.Println(strings.Join(lines, "\n"))
}

Quick links

Ports