No description
Find a file
2025-04-21 00:19:48 +03:00
go.mod Fixed typo in the module name. 2025-04-15 00:12:41 +03:00
go.sum First commit. 2025-04-15 00:10:39 +03:00
LICENSE Licence file is added. BSD-3 Non-AI. 2025-04-16 19:36:52 +03:00
README.md Fixed typo in README.md 2025-04-20 23:46:27 +03:00
ui.go Add some more logs. 2025-04-21 00:19:48 +03:00

The "UI" package

This package provides --verbose and --quiet flag features to your cli. It recognize both short and long flags. The package contains three functions:

  • PrintOut to print regular messages unless --quiet flag is set.
  • PrintVerbose to print messages only if --verbose flag is set, but --quiet flag is not.
  • SetupOutputMode to reconfigure output mode in the runtime.

Usage

  1. Download the package by go get command:
go get code.foilhatguy.casa/pub/ui
  1. Import package to your golang code:
import (
	"code.foilhatguy.casa/pub/ui"
)

There is no need for additional configuration. The package have its own init function to detect --verbose and --quiet flags.

  1. Use PrintOut and PrintVerbose functions to print messages to the standard output:
    ui.PrintOut("Some regular message.")
    ui.PrintVerbose("Some message printed only if --verbose flag is set.")