DatoCMS CLI
DatoCMS CLI tool for managing DatoCMS projects, environments and schemas.
Usage
$ npm install -g @datocms/cli
$ datocms COMMAND
running command...
$ datocms (--version)
@datocms/cli/0.1.6 darwin-x64 node-v16.20.0
$ datocms --help [COMMAND]
USAGE
$ datocms COMMAND
...
Commands
datocms autocomplete [SHELL]
display autocomplete installation instructions
USAGE
$ datocms autocomplete [SHELL] [-r]
ARGUMENTS
SHELL shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
display autocomplete installation instructions
EXAMPLES
$ datocms autocomplete
$ datocms autocomplete bash
$ datocms autocomplete zsh
$ datocms autocomplete --refresh-cache
See code: @oclif/plugin-autocomplete
datocms environments:destroy ENVIRONMENT_ID
Destroys a sandbox environment
USAGE
$ datocms environments:destroy [ENVIRONMENT_ID] [--json] [--config-file <value>] [--profile <value>] [--api-token
<value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to destroy
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Destroys a sandbox environment
See code: lib/commands/environments/destroy.js
datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Creates a new sandbox environment by forking an existing one
USAGE
$ datocms environments:fork [SOURCE_ENVIRONMENT_ID] [NEW_ENVIRONMENT_ID] [--json] [--config-file <value>] [--profile
<value>] [--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
[--force --fast]
ARGUMENTS
SOURCE_ENVIRONMENT_ID The environment to copy
NEW_ENVIRONMENT_ID The name of the new sandbox environment to generate
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--fast Run a fast fork. A fast fork reduces processing time, but it also
prevents writing to the source environment during the process
--force Forces the start of a fast fork, even there are users currently
editing records in the environment to copy
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Creates a new sandbox environment by forking an existing one
See code: lib/commands/environments/fork.js
datocms environments:index
Lists primary/sandbox environments of a project
USAGE
$ datocms environments:index [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--columns <value> | -x] [--sort <value>]
[--filter <value>] [--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
FLAGS
-x, --extended show extra columns
--api-token=<value> Specify a custom API key to access a DatoCMS project
--columns=<value> only show provided columns (comma-separated)
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--csv output is csv format [alias: --output=csv]
--filter=<value> filter property by partial string matching, ex: name=foo
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=<option> output in a more machine friendly format
<options: csv|json|yaml>
--profile=<value> Use settings of profile in datocms.config.js
--sort=<value> property to sort by (prepend '-' for descending)
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
datocms environments:list
Lists primary/sandbox environments of a project
USAGE
$ datocms environments:list [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--columns <value> | -x] [--sort <value>]
[--filter <value>] [--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
FLAGS
-x, --extended show extra columns
--api-token=<value> Specify a custom API key to access a DatoCMS project
--columns=<value> only show provided columns (comma-separated)
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--csv output is csv format [alias: --output=csv]
--filter=<value> filter property by partial string matching, ex: name=foo
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=<option> output in a more machine friendly format
<options: csv|json|yaml>
--profile=<value> Use settings of profile in datocms.config.js
--sort=<value> property to sort by (prepend '-' for descending)
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
See code: lib/commands/environments/list.js
datocms environments:primary
Returns the name the primary environment of a project
USAGE
$ datocms environments:primary [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Returns the name the primary environment of a project
See code: lib/commands/environments/primary.js
datocms environments:promote ENVIRONMENT_ID
Promotes a sandbox environment to primary
USAGE
$ datocms environments:promote [ENVIRONMENT_ID] [--json] [--config-file <value>] [--profile <value>] [--api-token
<value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to promote
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Promotes a sandbox environment to primary
See code: lib/commands/environments/promote.js
datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Renames an environment
USAGE
$ datocms environments:rename [ENVIRONMENT_ID] [NEW_ENVIRONMENT_ID] [--json] [--config-file <value>] [--profile
<value>] [--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to rename
NEW_ENVIRONMENT_ID The new environment ID
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Renames an environment
See code: lib/commands/environments/rename.js
datocms help [COMMAND]
Display help for datocms.
USAGE
$ datocms help [COMMAND] [-n]
ARGUMENTS
COMMAND Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for datocms.
See code: @oclif/plugin-help
datocms maintenance:off
Take a project out of maintenance mode
USAGE
$ datocms maintenance:off [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Take a project out of maintenance mode
See code: lib/commands/maintenance/off.js
datocms maintenance:on
Put a project in maintenance mode
USAGE
$ datocms maintenance:on [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--force]
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--force Forces the activation of maintenance mode even there are users
currently editing records
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--profile=<value> Use settings of profile in datocms.config.js
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Put a project in maintenance mode
See code: lib/commands/maintenance/on.js
datocms migrations:new NAME
Create a new migration script
USAGE
$ datocms migrations:new [NAME] [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--ts | --js] [--template <value>
| --autogenerate <value>]
ARGUMENTS
NAME The name to give to the script
FLAGS
--api-token=<value>
Specify a custom API key to access a DatoCMS project
--autogenerate=<value>
Auto-generates script by diffing the schema of two environments
Examples:
* --autogenerate=foo finds changes made to sandbox environment 'foo' and applies them to primary environment
* --autogenerate=foo:bar finds changes made to environment 'foo' and applies them to environment 'bar'
--config-file=<value>
[default: ./datocms.config.json] Specify a custom config file path
--js
Forces the creation of a JavaScript migration file
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS)
Level of logging for performed API calls
--log-mode=(stdout|file|directory)
Where logged output should be written to
--profile=<value>
Use settings of profile in datocms.config.js
--template=<value>
Start the migration script from a custom template
--ts
Forces the creation of a TypeScript migration file
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Create a new migration script
See code: lib/commands/migrations/new.js
datocms migrations:run
Run migration scripts that have not run yet
USAGE
$ datocms migrations:run [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--source <value>] [--dry-run] [--force
[--fast-fork [--destination <value> | --in-place]]] [--migrations-dir <value>] [--migrations-model <value>]
[--migrations-tsconfig <value>]
FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--destination=<value> Specify the name of the new forked environment
--dry-run Simulate the execution of the migrations, without making any actual
change
--fast-fork Run a fast fork. A fast fork reduces processing time, but it also
prevents writing to the source environment during the process
--force Forces the start of a fast fork, even there are users currently
editing records in the environment to copy
--in-place Run the migrations in the --source environment, without forking
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging for performed API calls
--log-mode=(stdout|file|directory) Where logged output should be written to
--migrations-dir=<value> Directory where script migrations are stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migrations scripts
--profile=<value> Use settings of profile in datocms.config.js
--source=<value> Specify the environment to fork
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Run migration scripts that have not run yet
See code: lib/commands/migrations/run.js
datocms plugins
List installed plugins.
USAGE
$ datocms plugins [--core]
FLAGS
--core Show core plugins.
DESCRIPTION
List installed plugins.
EXAMPLES
$ datocms plugins
See code: @oclif/plugin-plugins
datocms plugins:install PLUGIN...
Installs a plugin into the CLI.
USAGE
$ datocms plugins:install PLUGIN...
ARGUMENTS
PLUGIN Plugin to install.
FLAGS
-f, --force Run yarn install with force flag.
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Installs a plugin into the CLI.
Can be installed from npm or a git url.
Installation of a user-installed plugin will override a core plugin.
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
the CLI without the need to patch and update the whole CLI.
ALIASES
$ datocms plugins:add
EXAMPLES
$ datocms plugins:install myplugin
$ datocms plugins:install https://github.com/someuser/someplugin
$ datocms plugins:install someuser/someplugin
datocms plugins:available
Lists official DatoCMS CLI plugins
USAGE
$ datocms plugins:available [--json] [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output
csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
FLAGS
-x, --extended show extra columns
--columns=<value> only show provided columns (comma-separated)
--csv output is csv format [alias: --output=csv]
--filter=<value> filter property by partial string matching, ex: name=foo
--no-header hide table header from output
--no-truncate do not truncate output to fit screen
--output=<option> output in a more machine friendly format
<options: csv|json|yaml>
--sort=<value> property to sort by (prepend '-' for descending)
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists official DatoCMS CLI plugins
See code: lib/commands/plugins/available.js
datocms plugins:inspect PLUGIN...
Displays installation properties of a plugin.
USAGE
$ datocms plugins:inspect PLUGIN...
ARGUMENTS
PLUGIN [default: .] Plugin to inspect.
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Displays installation properties of a plugin.
EXAMPLES
$ datocms plugins:inspect myplugin
See code: @oclif/plugin-plugins
datocms plugins:install PLUGIN...
Installs a plugin into the CLI.
USAGE
$ datocms plugins:install PLUGIN...
ARGUMENTS
PLUGIN Plugin to install.
FLAGS
-f, --force Run yarn install with force flag.
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Installs a plugin into the CLI.
Can be installed from npm or a git url.
Installation of a user-installed plugin will override a core plugin.
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
the CLI without the need to patch and update the whole CLI.
ALIASES
$ datocms plugins:add
EXAMPLES
$ datocms plugins:install myplugin
$ datocms plugins:install https://github.com/someuser/someplugin
$ datocms plugins:install someuser/someplugin
See code: @oclif/plugin-plugins
datocms plugins:link PLUGIN
Links a plugin into the CLI for development.
USAGE
$ datocms plugins:link PLUGIN
ARGUMENTS
PATH [default: .] path to plugin
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
command will override the user-installed or core plugin implementation. This is useful for development work.
EXAMPLES
$ datocms plugins:link myplugin
See code: @oclif/plugin-plugins
datocms plugins:uninstall PLUGIN...
Removes a plugin from the CLI.
USAGE
$ datocms plugins:uninstall PLUGIN...
ARGUMENTS
PLUGIN plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
datocms plugins:uninstall PLUGIN...
Removes a plugin from the CLI.
USAGE
$ datocms plugins:uninstall PLUGIN...
ARGUMENTS
PLUGIN plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
See code: @oclif/plugin-plugins
datocms plugins:uninstall PLUGIN...
Removes a plugin from the CLI.
USAGE
$ datocms plugins:uninstall PLUGIN...
ARGUMENTS
PLUGIN plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
datocms plugins:update
Update installed plugins.
USAGE
$ datocms plugins:update [-h] [-v]
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Update installed plugins.
See code: @oclif/plugin-plugins
datocms profile:remove PROFILE_ID
Remove a profile from DatoCMS config file
USAGE
$ datocms profile:remove [PROFILE_ID] [--json] [--config-file <value>]
ARGUMENTS
PROFILE_ID The name of the profile
FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Remove a profile from DatoCMS config file
See code: lib/commands/profile/remove.js
datocms profile:set PROFILE_ID
Add/update profile configuration in DatoCMS config file
USAGE
$ datocms profile:set [PROFILE_ID] [--json] [--config-file <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--migrations-dir <value>] [--migrations-model <value>] [--migrations-template
<value>] [--migrations-tsconfig <value>]
ARGUMENTS
PROFILE_ID [default: default] Name of the profile to create/update
FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--log-level=(NONE|BASIC|BODY|BODY_AND_HEADERS) Level of logging to use for the profile
--migrations-dir=<value> Directory where script migrations will be stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-template=<value> Path of the file to use as migration script template
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migration scripts
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Add/update profile configuration in DatoCMS config file
See code: lib/commands/profile/set.js