Usage
Most of the time you will use the interactive prompt to configure the CLI, connect a Ghost instance, disconnect and do your operations.
If you want to bypass the interactive prompts, you can use the CLI with pipeable commands.
Export content with export <resource>
For example if we already configured the URL and the Content API key, we can export all the posts to the ./posts
folder with the following command:
Options available
--host
or-h
: The URL of the blog (if not provided, it will check your config file that is filled by the interactive prompt)--key
or-k
: The Content API key (if not provided, it will check your config file that is filled by the interactive prompt)--output
or-o
: The destination folder. If no output is provided, content will go to stdout.
Full example:
Available export
Display help
Export content from Admin API with export-admin <resource>
This export use the Admin API and require you to provide the Admin API key. An Admin API key is different from the Content API key. You can either use a Staff access token, visible at the bottom of a Ghost User profile or you can find it in your Ghost Admin panel, in the Integrations section.
This is useful if your Blog Posts contain a free preview, paid content and you want to export everything.
Options available
--host
or-h
: The URL of the blog (if not provided, it will check your config file that is filled by the interactive prompt)--key
or-k
: The Content API key (if not provided, it will check your config file that is filled by the interactive prompt)--output
or-o
: The destination folder. If no output is provided, content will go to stdout.
Full example:
Available export-admin <resource>
resources:
posts
pages
members
Example piping commands
You can use >
to pipe the content into a file or something else.