Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.88 KB

README.md

File metadata and controls

43 lines (30 loc) · 1.88 KB

Boilerplate combining Kong CLI argument parsing with zerolog logging

pkg.go.dev Go Report Card pipeline status coverage report

A Go package providing boilerplate combining Kong CLI argument parsing with zerolog logging.

Features:

  • Config (from files, CLI arguments, and environment variables) is parsed into a struct based on struct tags, powered by Kong.
  • JSON-based and pretty-printed logging, powered by zerolog.
  • Support for built-time version variables and CLI flag.
  • Handles exit codes: 0 for success, 1 for initialization errors (CLI argument parsing or zerolog configuration failures), 2 for panics, and 3 for program errors.
  • All logging goes to stdout and unexpected errors go to stderr.
  • On errors, a stack trace and other details from errors are shown, powered by gitlab.com/tozd/go/errors.

Installation

This is a Go package. You can add it to your project using go get:

go get gitlab.com/tozd/go/cli

It requires Go 1.23 or newer.

Usage

See full package documentation on pkg.go.dev.

See examples.

GitHub mirror

There is also a read-only GitHub mirror available, if you need to fork the project there.