56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "func.h"
|
|
#include "config/config.h"
|
|
|
|
char *defaultOptions[]={"help","add","run","del","rm"};
|
|
|
|
void addCmd(char ** str);
|
|
void delCmd(char ** str);
|
|
void runCmd(char ** str);
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc<2) {
|
|
printHelp();
|
|
return 0;
|
|
}
|
|
int choice = whichOption(defaultOptions,argv[1]);
|
|
|
|
switch (choice) {
|
|
case 0:
|
|
printHelp();
|
|
return 0;
|
|
case 1: // add
|
|
addCmd(&argv[2]);
|
|
return 0;
|
|
case 2: // run
|
|
runCmd(&argv[2]);
|
|
return 0;
|
|
case 3:
|
|
case 4: {
|
|
delCmd(&argv[2]);
|
|
return 0;
|
|
}
|
|
default: ;
|
|
}
|
|
loadConfig("config.json");
|
|
return 0;
|
|
}
|
|
|
|
void addCmd(char ** str) { //TODO: implement
|
|
int i=0;
|
|
while (*(str+i)) {
|
|
printf("adding %s \n", *(str+i));
|
|
i++;
|
|
}
|
|
}
|
|
void delCmd(char ** str) { //TODO: implement
|
|
printf("removed %s \n", *str);
|
|
}
|
|
void runCmd(char ** str) { //TODO: implement
|
|
printf("running %s \n", *str);
|
|
}
|
|
|
|
|
|
|