DEV Community

Cover image for My first command-line tool!
Gulnur Baimukhambetova
Gulnur Baimukhambetova

Posted on • Updated on

My first command-line tool!

Hello everyone!

Today, I want to present to you my first command-line tool that I have been working on in the last three days.

It was part of the course work. However, we were only presented with the requirements. So, no implementation instructions were given.

To be honest, at first, I was so scared. I usually feel alright with figuring the things out along the way, but this project was entirely new. It was focusing on the creation of the command-line tool for static site generation, which I have never done before. I was also never a fan of web development, so it pushed me out of my comfort zone.

However, closer to the end, I realized that I was thinking about implementing the features that I have not been asked to do. I got sucked into the project and truly cared about its development. I wanted to improve it as much as I can. Suddenly, it became so interesting...

So, here it is, my baby SSGulnur!

SSGulnur is a static site generator command-line tool created by me, Gulnur. It allows you to transform txt files into html pages in a matter of seconds. You can also specify the output folder or a stylesheet of your choice.

Below you can see the details:

For the installation, node is required. First clone this repository to your local machine, then navigate to the cloned directory in your terminal and run npm to install globally npm install -g.

Usage.

ssgulnur -v | --version displays the tool's name and current version.

ssgulnur -h | --help displays a help guide with all instructions.

ssgulnur -i | --input <source>

  • Source can be a single file or folder which can also contain sub-folders.
  • For file names with spaces, please use quotation marks. For example: ssgulnur -i "Example file path.txt".
  • For each provided file an html file will be generated. By default, all html files will be placed into the ./dist folder.
  • All titles need to be the first line in the file followed by two blank lines. Otherwise, it will be considered as part of the story.
  • Different options are available:
    • -o \| --output|<folder> Allows to specify an output folder name. If exists, will be used, if not, gets created. Cannot be a file. By default, ./dist.
    • -s \| --stylesheet|<url> Allows to specify a particular stylesheet to use for html styling. For example, https://cdn.jsdelivr.net/npm/water.css@2/out/water.css

Examples

  • ssgulnur -i "Example file path.txt"
  • ssgulnur --input exampleFolderPath --output exampleOutputFolderPath

You can find the source code here: https://github.com/gulyapulya/SSGulnur.

TADAAAA!

Tadaa

Top comments (0)