DEV Community

Tue
Tue

Posted on

Build a command line program with commander.js

Features

  • It accepts .txt files and converts them into .html files.
  • User can specify output folder where converted .html files will be placed
  • If a folder is specified for input, it will look for all .txt files in the folder and subfolder(s)
  • An index.html containing links to other .html files is generated

Usage:

Option Description
-V, --version output the version number
-o, --output specify a path to output .html files
-i, --input (required) transform .txt files into .html files
-h, --help display help for command

Example:

textfiles

image

Silver Blaze.txt

image

After executing node index.js -i ./textfiles -o ./output, .txt' files will be converted to.html` files

image

index.html

image

The Naval Treaty.html

image

Notes:

The program doesn't catch all errors, if you encounter any error please let me know at tnguyen187@myseneca.ca or tuenguyen12329@gmail.com

Top comments (0)