Package badger
A CLI to create badges.
This CLI can create PNG and SVG badges. The goal is to support the creation
of badges in existing CI/CD pipelines, without needing to rely on third-party
services.
Install
The package can be installed from the command line using the go tool. There are no dependencies beyond the standard library. Any version of Go should work, but testing only covers version 1.8 and up.
go install git.sr.ht/~rj/badger@latest
Getting Started
The badger
command has a number of sub-commands, each of which creates a badge of a particular format. The general structure in all cases is:
badger <command> [options] <value>
badger <command> --help
The types of badges that can be created are:
badger count [options...] <caption> <number>
badger coverage [options...] <percentage>
badger passfail [options...] <caption> <bool>
badger text [options...] <caption> <text>
The badger
command support a number of different output formats. These can be selected using the -mimetype
option. By default, the badge will be created as an SVG image. Additional options are: PNG image, and SGR text.
For example,
badger coverage -mimetype=png 90.1%
Options
-caption
: For badges with a default caption, this option allows the caption to be overridden.
-height
: Change the height (in pixels) of the badge.
-mimetype
: Change the output format of the badge.
-minwidth
: Change the minimum width of the badge. The program may increase the badge width, if necessary to fit all of the requested elements.
-o
: Change the path of the output file. By default, the badge will be printed to stdout
.
Contribute
To submit bug reports and suggestions, please use the issue tracker.
Discussions occur using the mailing list. The mailing list can also be used to submit patches.
License
BSD (c) Robert Johnstone