Added error message if missing argument.
Removed hard coded blog and atom templates. Removed resources folder to BlogPosts repo.
This commit is contained in:
parent
8c1b0e099b
commit
c3ba877c0e
46 changed files with 24 additions and 1657 deletions
24
Src/blog.cpp
24
Src/blog.cpp
|
@ -1,9 +1,11 @@
|
|||
#include "MacroDefinitions.h"
|
||||
// #include "MacroDefinitions.h"
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include "Program.h"
|
||||
|
||||
|
@ -32,7 +34,10 @@ std::string getArgValue(int argc, char* argv[], std::string argIdString)
|
|||
if (strncmp(argId, argv[i], idValSplit) == 0)
|
||||
return std::string(argv[i]).substr(idValSplit+1, strlen(argv[i])-(idValSplit+1));
|
||||
}
|
||||
return "";
|
||||
|
||||
std::cout << "Missing argument!"; //the program exists if the value is 0
|
||||
std::cout << argIdString;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
bool doesArgExist(int argc, char* argv[], std::string argIdString)
|
||||
|
@ -61,28 +66,23 @@ void copyFolderAndContents(std::string inUrl, std::string outUrl)
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::string source = getArgValue(argc, argv, "-in=");
|
||||
if (source == "")
|
||||
source = SOURCE_FILE_FOLDER;
|
||||
std::string output = getArgValue(argc, argv, "-out=");
|
||||
if (output == "")
|
||||
output = OUTPUT_FILE_FOLDER;
|
||||
std::string stat = getArgValue(argc, argv, "-static=");
|
||||
if (stat == "")
|
||||
stat = STATIC_RESOURCES_FOLDER;
|
||||
std::string siteWebUrl = getArgValue(argc, argv, "-url=");
|
||||
if (siteWebUrl == "")
|
||||
siteWebUrl = SITE_WEB_URL;
|
||||
std::string blogTemplate = getArgValue(argc, argv, "-blogTemplate=");
|
||||
std::string atomTemplate = getArgValue(argc, argv, "-atomTemplate=");
|
||||
|
||||
|
||||
int flags = OptionFlags::NONE;
|
||||
if (doesArgExist(argc, argv, "-hide"))
|
||||
flags |= OptionFlags::HIDE_PRIVATE;
|
||||
|
||||
Program* program = new Program(source, output, RESOURCE_FOLDER "/Templates/BlogPageTemplate.html", RESOURCE_FOLDER "/Templates/AtomFeedTemplate.xml", siteWebUrl, flags);
|
||||
Program* program = new Program(source, output, blogTemplate, atomTemplate, siteWebUrl, flags);
|
||||
program->buildAll();
|
||||
|
||||
// pre-written pages and resources i.e. images
|
||||
copyFolderAndContents(stat, output);
|
||||
|
||||
std::cout << "Enjoy your website :)";
|
||||
}
|
||||
|
||||
// TODO: nav sections :eww:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue