# form-cli

> A command line utility to populate placeholders in a form template and save or print the output.

Latest version **2.0.0** (published 2026-09-20) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install form-cli
pnpm add form-cli
yarn add form-cli
bun add form-cli
```

Provides the command `form-cli`.

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

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

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-09-20 |
| First published | 2017-07-21 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22 |
| Dependencies | 4 |
| Unpacked size | 28.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tecfu |
| Maintainers | tecfu |
| Keywords | cli, form, terminal |

## Links

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

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [yargs](https://npm.io/package/yargs.md) ^13.2.4
- [tty-table](https://npm.io/package/tty-table.md) ^2.7.1
- [readline-sync](https://npm.io/package/readline-sync.md) ^1.4.9

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-09-20
- 1.0.3 — 2019-07-14
- 1.0.2 — 2018-07-31
- 1.0.1 — 2017-07-21
- 1.0.0 — 2017-07-21

## README

# form-cli

A command-line utility for populating `%PLACEHOLDER%` fields in a text template and saving or printing the result.

## Requirements

- Node.js 22 or newer

## Install

```sh
npm install -g form-cli
```

## Usage

```sh
form-cli --template path/to/form.txt
```

For each placeholder in the template, `form-cli` prompts for a value, shows a review table, and lets you edit entries before generating the output.

### Options

- `-t, --template <path>` — template file to populate (required)
- `-s, --save <path>` — save the generated output directly to the specified path
- `-p, --printer <name>` — print the generated output to the named printer
- `-h, --help` — show command help

If `--save` is omitted, the CLI asks whether to save the output and offers a generated filename. Input values can also be saved as JSON when requested.

## Template syntax

Placeholders are delimited by `%` characters, for example:

```text
Dear %FIRST-NAME%,

Your email is %EMAIL.ADDRESS%.
```

Placeholder names may contain punctuation other than `%` and line breaks. Values are inserted literally, so characters such as `$` are not treated as replacement expressions.

Templates without placeholders are supported and simply produce their original contents.

## Development

Run the test suite with:

```sh
npm test
```

Continuous integration runs the tests on Node.js 22 and 24.

## Docker

Docker is an optional way to run `form-cli` without installing Node.js on the host. It is most useful for automated, isolated, or otherwise controlled environments. For normal interactive use—and especially when using local printers—installing `form-cli` directly is recommended.

Build the image from this repository:

```sh
docker build -t form-cli .
```

Run it against a template in the current directory:

```sh
docker run --rm -it \
  -v "$PWD:/work" \
  form-cli --template /work/form.txt
```

The container runs the CLI with `/work` as its working directory, so paths passed to `form-cli` should refer to files in the mounted directory.

Printing from inside the container is not recommended because the container does not automatically have access to printers configured on the host. Use a native installation for `--printer`.

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