Overview

The Ditto CLI allows developers to access the Ditto API directly from the command line. The Ditto CLI updates text directly in local development. Teams can also build workflows with the CLI, including utilizing it in CI/CD.

Installation

To install the CLI as a development dependency:

npm i --save-dev @dittowords/cli

After installation, you can get a list of the available commands by running the help command:

npx @dittowords/cli --help

Note: npx comes with npm 5.2 or higher

Authentication

The first time you run the CLI, you’ll be asked to provide an API key. You can generate an API key in your developer integrations settings.

Fetching text

Once you’ve installed, authenticated, and configured the CLI, you’ll be able to pull down up-to-date text by running the CLI:

npx @dittowords/cli pull

This will update the string files you have locally in the /ditto directory from where you’re running the CLI. (For more information on the structure of files pulled by Ditto, see files)

Because the Ditto CLI updates your string files locally, you can continue to manage it as you would with any other product update (push it to staging, commit changes to a branch, etc.).