Dev Center CLI
Last updated April 06, 2023
This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.
Table of Contents
The Dev Center CLI lets authors edit and preview Dev Center articles locally.
Installation
Set up Ruby on your local machine. Then install the Dev Center CLI gem:
$ gem install devcenter
You’ll also need the Heroku CLI if you want to save your articles to Dev Center.
Pull your article
Download a local copy of an article with devcenter pull
followed by the article URL:
$ devcenter pull https://devcenter.heroku.com/articles/dev-center-cli
"Dev Center CLI" article saved as ~/.../dev-center-cli.md
This will save a dev-center-cli.md
text file in your local directory.
Edit and preview locally
Open the file with your text editor: you will see that the file includes some metadata followed by the article content in markdown format.
The following command will open a preview in your default browser:
$ devcenter preview dev-center-cli
Live preview for error-pages available in http://127.0.0.1:3000/dev-center-cli
It will refresh when you save ~/.../dev-center-cli.md
Press Ctrl+C to exit...
Now start editing the article’s content: the preview will auto-refresh whenever you save the file, so you can see the content you’re editing and its preview side by side.
Metadata
The markdown file includes some metadata fields. You can edit title
, but never overwrite the id
field: you’ll need it to save your changes in Dev Center.
Stop the preview
To stop the preview
command, press Ctrl+C.
Save the article to Dev Center
Save your local changes to Dev Center using the devcenter push
command:
$ devcenter push dev-center-cli.md
Your local heroku account will be used to push the article. Use heroku auth:whoami
to see which account will be used to push the article and heroku auth:login
if you need to login with a different account.
Additional help
Get a list of all the available commands with:
$ devcenter help
To get help for a specific command and its available options, e.g: preview
:
$ devcenter help preview
Issues and pull requests
The Dev Center CLI is open source, you can access its repo to get the code, report issues or send pull requests.