blogs-cli

blogs-cli

CLI tool to create, publish and edit jekyll blogs

Blog Writing Command Line Tool

Recently, I was thinking of implementing a command line tool to write my blog posts https://rish-singhal.github.io/blogs making it easier for me to write and publish the same.

This command line tool can be spawned anywhere in the terminal and it will take care of the rest.

Currently, it is capable of creating a markdown file at the specified path (jekyll blogs _posts directory) with a given template which includes title and opening the same in the editor of choice.

Table of Contents

Instructions to install

Clone the repository

$ git clone https://github.com/rish-singhal/blogs-cli.git

Install the dependencies by executing following command in the cloned repository

$ npm install

Install the tool

$ npm install --global .

Usage

Execute the following to start the tool

$ rishblogs

Note: The name of the command can be changed in the packagage.json file by replacing rishblogs with the desired name in the "bin": {} property.

{
    "bin": {
        "new-name": "./bin/blogs-cli.js"
    }
}

The interface would be as follows:

The following commands are currently supported:

To create a new blog, enter create and give all the arguments (blog post name, path, editor commmand) required

blogs-cli> create

To exit the tool, enter exit

blogs-cli> exit

Tech Used

The CLI tool is implemented in NodeJS.

To be done

Commands

  • publish: To publish the blog posts to git
  • edit: To edit existing blog post
  • list: To list all the blog posts
  • delete: To delete one of the blog posts

Features

  • Allowing going back to the previous commands by up and down arrows.

Ideas

  • Follow good node practices.
  • Explore and use functional programming in NodeJS.
  • Add unit tests for the CLI tool.

Author

Rishabh Singhal