Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 2.2% dependent packages on proxy.golang.org
Top 2.9% dependent repos on proxy.golang.org

proxy.golang.org : github.com/clintjedwards/polyfmt

Package polyfmt is a convenience package that provides multiple forms of formatted output. Useful for CLI applications where you might want to provide JSON output for machine users, but pretty output for interactive users. In a command line application you usually want to provide some well-formatted output to users. This may include progress bars, timers, spinners, or tables so that interactive users can better parse your programs output. For non-interactive users or automation this might make your CLI application difficult to parse, build automation around, or just unnecessarily verbose. To this end, you might want to provide a common serialization format to users who use your CLI app from within a non-interactive environment. Polyfmt aims to simplify the API around multiple formatting options and make it easy to switch between them. Polyfmt provides a very simple API, full of print functions. Initiate a new formatter instance, passing in what type of formatter you want back. This is usually passed in by your user at runtime via flags or config. Use the returned formatter to print a simple json formatted hello. You can also pass the printer any interface and it will attempt to print it (providing that it is printable). Sometimes you'll want to output something only for specific formatters. Most commands take a list of formatters, which tells the command to only print for those formatters. You can turn off color by using the popular `NO_COLOR` environment variable.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/clintjedwards/polyfmt
Keywords: cli, formatter, golang, json, spinner
License: MIT
Latest release: about 1 year ago
First release: about 3 years ago
Namespace: github.com/clintjedwards
Dependent packages: 6
Dependent repositories: 3
Stars: 1 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 13 days ago

    Loading...
    Readme
    Loading...