CLI Reference

The Ditto CLI helps teams integrate Ditto into their build processes. You can use it to pull copy into your codebase using the Ditto API right from the terminal.

Installation + Authentication

For instructions on installing and logging into the CLI, check out these links:

Once you successfully provide that information, you’re ready to start fetching copy! You can set up the CLI in multiple directories by running the ditto-cli command and choosing a project to sync from.

Commands

pull

Usage: ditto-cli pull Action: To pull the latest text from the linked project into ditto/text.json.

The text will be pulled down as a structured JSON with IDs, and will locally overwrite what was previously in the file.

project

Usage: ditto-cli project

Action: To change the Ditto project you want to pull copy from in the current directory. Running this will allow you to select a project from a list of projects in your workspace that have developer mode enabled.

The Ditto project that the directory is synced with is defined in ditto/config.yml, and you can also manually change the linked project there.

Files

ditto/

This folder is associated with your current working directory, so if you switch directories, we'll create a new folder there.

  • config.yml

    This stores the information on which Ditto project you've selected to pull copy from in this directory.

    You can change which project is defined here using the project command, or by manually replacing the contents of this file. If you switch directories, you'll automatically be prompted to choose a project to pull from.

  • text.json

    The copy pulled from your Ditto project is saved to this file. Learn more about how this content is structured and how the IDs are generated by reading our guide here.

.config/ditto

Your API key is saved to this file in your root directory. To change your API key, you'll need to open this file and replace the key manually.