# cli-sprintf-format

> sprintf formatting targetted for CLI

Latest version **1.1.1** (published 2021-12-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install cli-sprintf-format
pnpm add cli-sprintf-format
yarn add cli-sprintf-format
bun add cli-sprintf-format
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-12-21 |
| First published | 2018-09-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0 |
| Dependencies | 4 |
| Unpacked size | 34.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mariusz Nowak |
| Maintainers | medikoo |
| Keywords | printf, sprintf, log, format, string, cli, ansi |

## Links

- npm: https://www.npmjs.com/package/cli-sprintf-format
- Repository: https://github.com/medikoo/cli-sprintf-format
- Homepage: https://github.com/medikoo/cli-sprintf-format#readme
- Issues: https://github.com/medikoo/cli-sprintf-format/issues
- npm.io page: https://npm.io/package/cli-sprintf-format

## Dependencies (4)

- [es5-ext](https://npm.io/package/es5-ext.md) ^0.10.53
- [cli-color](https://npm.io/package/cli-color.md) ^2.0.1
- [sprintf-kit](https://npm.io/package/sprintf-kit.md) ^2.0.1
- [supports-color](https://npm.io/package/supports-color.md) ^6.1.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-12-21
- 1.1.0 — 2018-10-02
- 1.0.0 — 2018-09-28

## README

[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![npm version][npm-image]][npm-url]

# cli-sprintf-format

## CLI dedicated sprintf formatter

An improved version of [util.formatWithOptions](https://nodejs.org/api/util.html#util_util_formatwithoptions_inspectoptions_format_args)

- Provides more reliable type resolution and error handling
- Detects color support (via [supports-color](https://github.com/chalk/supports-color#readme))
- Ensures colored (if supported) output not only for the inspected objects but also for primitive vaulues
- Colored JSON (`%j`) formatting
- Object inspection depth defaults to `4`, but can be overriden via `FORMAT_INSPECT_DEPTH` environment variable
- For `%s` strings are passed through [`inspect`](https://nodejs.org/api/util.html#util_util_inspect_object_options) formatter therefore appear colored (if supported) and eventual multiline content appears inline. To escape that behavior `%#s` should be used instead

### Installation

```bash
npm install cli-sprintf-format
```

### Usage

```javascript
const cliFormat = require("cli-sprintf-format");

console.log(cliFormat("Some %s with %d count", "foo", 12)); // Some foo with 12 count
```

### Tests

```bash
npm test
```

[build-image]: https://github.com/medikoo/cli-sprintf-format/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/cli-sprintf-format/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/cli-sprintf-format.svg
[cov-url]: https://codecov.io/gh/medikoo/cli-sprintf-format
[npm-image]: https://img.shields.io/npm/v/cli-sprintf-format.svg
[npm-url]: https://www.npmjs.com/package/cli-sprintf-format

---
_Source: https://npm.io/package/cli-sprintf-format · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
