maxime1992 / dev-to-git

Publish a blog post (markdown file) to Dev.to from your command line or from CI with this CLI
MIT License
27 stars 13 forks source link

One-command article creation #8

Open zakhenry opened 5 years ago

zakhenry commented 5 years ago

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.

daKmoR commented 3 years ago

sounds like a good idea 👍