leg

package module
v0.2.1-0...-0eeed1c Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 3 Imported by: 0

README

leg

Archived, now just using slog.


Screenshot 2023-03-06 at 14 18 25

GoDoc Build Status

Tiny wrapper to beauty command line application prototypes with a minimal effort.

  • Prints to stderr.
  • Thanks to color library:

Install

go get -u github.com/jesusprubio/leg
Dependencies
  • Go stable version.

Use

Visit the tests to check more details.

leg.Head("mumu", "🐘", "0.1.0")
leg.Info("Informational message", "")
leg.Success("Successful operation", "")
leg.Warn("Warn message", "")
leg.Error("Error message", "")
leg.Wait("Waiting for something", "")
leg.Done("Something finished", "")

leg.Info("Informational message with scope", "scope-0")

fmt.Print("deleted line")
leg.Remove()

leg.Result("To standard output")

Documentation

Overview

Package leg provides helpers to print the most common type of messages used in command line applications.

For simplicity, parameters of the different functions are not validated. It is not fun to check for errors when printing messages. The benefits would not be worth it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Done

func Done(message string, scope string)

Done indicates something finished.

- `message`: String to print. - `scope`: Prefix to append.

func Error

func Error(message string, scope string)

Error prints about an errored operation.

- `message`: String to print. - `scope`: Prefix to append.

func Head(name string, icon string, version string)

Head prints a simple application header/title.

- `name`: Name of the project. - `icon`: Optional icon to display. - `version`: Include also the version.

func Info

func Info(message string, scope string)

Info prints generic data.

- `message`: String to print. - `scope`: Prefix to append.

func Remove

func Remove() error

Remove deletes the actual line..

func Result

func Result(message string)

Result prints to the standard output.

- `message`: String to print.

func Success

func Success(message string, scope string)

Success prints about a correct operation.

- `message`: String to print. - `scope`: Prefix to append.

func Wait

func Wait(message string, scope string)

Wait indicates a delay.

- `message`: String to print. - `scope`: Prefix to append.

func Warn

func Warn(message string, scope string)

Warn prints about a not completely correct operation.

- `message`: String to print. - `scope`: Prefix to append.

Types

This section is empty.

Jump to

Keyboard shortcuts

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