Skip to content
/ go-cli Public

Boilerplate combining Kong CLI argument parsing with zerolog logging. Read-only mirror of https://gitlab.com/tozd/go/cli

License

Notifications You must be signed in to change notification settings

tozd/go-cli

Repository files navigation

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.21 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.

About

Boilerplate combining Kong CLI argument parsing with zerolog logging. Read-only mirror of https://gitlab.com/tozd/go/cli

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  
  •  

Packages

No packages published