dev-to-git icon indicating copy to clipboard operation
dev-to-git copied to clipboard

One-command article creation

Open zakhenry opened this issue 6 years ago • 1 comments

Thinking about how to extend dev-to-git so that it can automatically create an article without the manual step of going to dev.to

proposed command

dev-to-git create-article "My amazing new blog post"

I've raised #7 to better help with the creation of more complicated CLI commands

basically the way I see this working is

  1. command creates a new markdown file without saving it to disk
    • Frontmatter is initialized with the title and empty values for all other fields
  2. dev.to POST api is invoked creating this new article
  3. response is analysed and the article ID is inserted into the frontmatter of the in-memory markdown article
  4. On success of all above steps, the article is written to disk
  5. If there is a .dev-to-git.json config file present (I'm planning on making this optional), the newly created article is appended.

By inserting the id into the frontmatter, this gives us the ability to update the article by simply reading the markdown file to be published.

zakhenry avatar Jul 13 '19 17:07 zakhenry

sounds like a good idea 👍

daKmoR avatar Aug 27 '20 08:08 daKmoR