blob: 203f79aa4d49862d01115cd1af34e5b896b878e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "core.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void printError(const char *s) {
printf("ERROR: %s\n", s);
}
void printInfo(const char *s) {
printf("INFO: %s\n", s);
}
void gitrolex_parseArgs(struct State_t *s, int argc, const char *argv[]) {
const char *task;
if(argc < 2) {
s->task = ERROR;
return;
}
task = argv[1];
if(!strcmp(task, "status")) {
s->task = STATUS;
}
else if(!strcmp(task, "export")) {
s->task = EXPORT;
}
else if(!strcmp(task, "track")) {
// if we're tracking time,
// we need a branch name stored
// in the args
if(argc < 3) {
s->task = ERROR;
return;
}
s->task = TRACK;
strcpy(s->taskArgs, argv[2]);
}
}
int gitrolex_core(int argc, const char* argv[]) {
struct State_t state;
gitrolex_parseArgs(&state, argc, argv);
printf("Usage ./gitrolex status | export | track <branch-name>\n");
}
|