gosplash

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 4 Imported by: 11

README

GoSplash

Library to show log lines at the start of a program

Build status

Last release GitHub last release date Commits since release

GitHub last commit GitHub commit activity GitHub closed PRs GitHub issues GitHub closed issues

Lines of code Code size GitHub repo size Go version

MIT Visitors count

==================================================
==================================================
==================== 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? quentin.mcgaw@gmail.com
💰 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"))
}

Ports

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeLines

func MakeLines(settings Settings) (lines []string)

MakeLines returns the lines to log out.

Types

type Format

type Format uint8
const (
	DefaultFormat Format = iota
)

type Settings

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"
	BuiltBy      string // optional
	Announcement string
	AnnounceExp  time.Time // leave to zero value to disable expiration

	// Sponsor information
	PaypalUser    string
	GithubSponsor string
}

Directories

Path Synopsis
examples
main command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL