Shero – CLI usage instructions
What is shero-CLI?
Many programmers use Git’s issue to blog because the comment section of the issue provides a forum for discussion between the author and the reader. However, if an issue is used to write a blog, the direct relationship between the blog content and the issue needs to be maintained. The author needs to maintain a blog warehouse by himself, and then copy it to the issue after the blog is completed. To make blogging with Github’s issues more enjoyable, the shero-CLI tool was developed. The main functions are as follows:
- Create a blog from the command line
- Blog from the command line
- Generate a directory list of MD files in the warehouse to reduce maintenance costs
Shero -cli Github address
Project design drawing
How to use
1. Shero – cli installation
npm install shero-cli -g
Copy the code
2. Access your local blog repository
Since creating a blog repository is a low-frequency operation, shro-cli does not support command line to create a blog repository on Github.
3. Shero cli initialization
shero-cli init
Copy the code
You need to enter a user name (github user name), repository name (blog repository name) and token as prompted. Since shro-cli needs to create an issue in the Github repository, you need a token to have permission. The token can be obtained in the following ways: This token will only appear once, please click Copy to save.
To learn more about git tokens, see this article about obtaining Git tokens.
4. Create a blog
shero-cli create <blogName>
Copy the code
- Note that blogName is the name of the blog and is also presented as the title of the issue
- BlogName is mandatory. The suffix.md is optional. Md files are generated by default
5. Post or update a blog post
shero-cli publish <blogName>
Copy the code
Shero – CLI automatically identifies whether the issue corresponding to the published blog exists. If it exists, it updates the issue, and if it does not, it creates a new issue.
TODO list
This tool I was to develop a version, some functions will continue to add and improve. Rd friends are also welcome to put forward their own ideas and suggestions, and even participate in the development of this tool.
- Shero -cli close [blogName] (Issue closed)
- Shero -cli delete [blogName] (delete blog)
- Support for templates for blog headers and tails
- Support blog classification
- Explore open nuggets, Jianshu and other blog platforms, to achieve one-click publish
Refer to the article
Nodejs API website
About obtaining git tokens
Packaged Github API library: Octokit