Implemented --new #40
11
focussg.c
11
focussg.c
|
|
@ -5,12 +5,17 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "BlogDB.h"
|
#include "BlogDB.h"
|
||||||
|
|
||||||
|
static int ArgNewPost();
|
||||||
static int ArgAddAuthor();
|
static int ArgAddAuthor();
|
||||||
static int HelpMessage();
|
static int HelpMessage();
|
||||||
static int VersionMessage();
|
static int VersionMessage();
|
||||||
static int ShortArg(char currentArg[], int argIndex, char *argv[]);
|
static int ShortArg(char currentArg[], int argIndex, char *argv[]);
|
||||||
static int LongArg(char currentArg[], int argIndex, char *argv[]);
|
static int LongArg(char currentArg[], int argIndex, char *argv[]);
|
||||||
|
|
||||||
|
int ArgNewPost()
|
||||||
|
{
|
||||||
|
BlogWrite(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int ArgAddAuthor()
|
int ArgAddAuthor()
|
||||||
{
|
{
|
||||||
|
|
@ -40,6 +45,7 @@ int HelpMessage()
|
||||||
printf("Usage: focussg [OPTION]\n");
|
printf("Usage: focussg [OPTION]\n");
|
||||||
printf("FoCuSSG (Fordsmand's C Static Site Generator)\n");
|
printf("FoCuSSG (Fordsmand's C Static Site Generator)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
printf(" -n, --new Open up $EDITOR and add saved post to database\n");
|
||||||
printf(" --add-author Add another author to the database\n");
|
printf(" --add-author Add another author to the database\n");
|
||||||
printf(" -h, --help Show this help message.\n");
|
printf(" -h, --help Show this help message.\n");
|
||||||
printf(" -V, --version Show the version number of FoCuSSG.\n");
|
printf(" -V, --version Show the version number of FoCuSSG.\n");
|
||||||
|
|
@ -63,6 +69,9 @@ int ShortArg(char currentArg[], int argIndex, char *argv[])
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
switch (options[i]) {
|
switch (options[i]) {
|
||||||
|
case 'n':
|
||||||
|
ArgNewPost();
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
HelpMessage();
|
HelpMessage();
|
||||||
break;
|
break;
|
||||||
|
|
@ -86,6 +95,8 @@ int LongArg(char currentArg[], int argIndex, char *argv[])
|
||||||
|
|
||||||
if (strcmp(option, "help") == 0)
|
if (strcmp(option, "help") == 0)
|
||||||
HelpMessage();
|
HelpMessage();
|
||||||
|
else if (strcmp(option, "new") == 0)
|
||||||
|
ArgNewPost();
|
||||||
else if (strcmp(option, "add-author") == 0)
|
else if (strcmp(option, "add-author") == 0)
|
||||||
ArgAddAuthor();
|
ArgAddAuthor();
|
||||||
else if (strcmp(option, "version") == 0)
|
else if (strcmp(option, "version") == 0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue