Link to repository: https://github.com/alexsam29/ssg-cli-tool
This tool allows a user to specify a text (.txt) file path or a directory path as an argument in the command-line. A HTML file will then be created based on the specified text file. If a directory was specified, then HTML files will be created for every .txt file in the directory.
In order to start using this tool, a recent version of Node.js must be downloaded and installed on your local machine.
Clone or download the repository from GitHub to your local machine. Remember the file location!
Open a terminal or command window and move to the directory where the repository was downloaded to.
Before moving forward make sure to run the command:
npm install -g
to ensure that all npm packages are installed.
Start using the tool by inputting the path of a text file or folder using the -i/--input option. For example:
ssg -i fileOrFolder_path
The file specified will be added to the 'dist' directory. If it is a directory, all text files will be converted to HTML and added to the same directory. An index.html file will also be created with links to all HTML files generated.
[OPTIONAL] You can specify the directory where you want to output the HTML files by using the -o/--output option. For example:
ssg -i file_path -o directoryPath
If the directory does not exist, a new one will be created. If it does, then the contents will be erased and the new HTML files will be added.
Final output example: https://alexsam29.github.io/ssg-cli-tool/
- -h/--help: This will output a list of all available options
- -v/--version: This will output the name of the tool, version number and author name.
- -i/--input: The main function of this tool. Convert text file(s) to HTML by specifying the file/folder path.
- -o/--output: Specify the directory to add HTML files to.
In addition to the main requirements of the release, I have also added 3 of the optional requirements.
- The title is parsed from the input files and used to populate the tag and added to the top of the .
- As described above, I implemented the option for the user to specify the output directory with -o/--output.
- An index.html page is created when the user inputs a folder path. This file contains links to each of the generated HTML files.