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.
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 .
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
The CLI tool is implemented in NodeJS.
publish
: To publish the blog posts to gitedit
: To edit existing blog postlist
: To list all the blog postsdelete
: To delete one of the blog postsup
and down
arrows.