-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontent-fetch.c
More file actions
66 lines (54 loc) · 1.63 KB
/
content-fetch.c
File metadata and controls
66 lines (54 loc) · 1.63 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <external.h>
#include <caneka.h>
#include <test_module.h>
i32 main(int argc, char **argv){
if(argc > 1){
for(int i = 1; i < argc; i++){
char *arg = argv[i];
if(strncmp(arg, "no-color", strlen("no-color")) == 0){
GLOBAL_flags |= NO_COLOR;
}
if(strncmp(arg, "html", strlen("html")) == 0){
GLOBAL_flags |= HTML_OUTPUT;
}
}
}
MemBook *cp = MemBook_Make(NULL);
if(cp == NULL){
Fatal(FUNCNAME, FILENAME, LINENUMBER, "MemBook created successfully", NULL);
}
MemCh *m = MemCh_Make();
if(m == NULL){
Fatal(FUNCNAME, FILENAME, LINENUMBER, "MemCh created successfully", NULL);
}
#ifdef CNKOPT_EXT
Caneka_Init(m);
#else
Caneka_InitBase(m);
#endif
Core_Direct(m, 1, 2);
#ifdef CNKOPT_INTER
Inter_Init(m);
#endif
DebugStack_Push(NULL, 0);
CliArgs *cli = CliArgs_Make(argc, argv);
Str *helpKey = K(m, "help");
Str *noColorKey = K(m, "no-color");
Str *sha256Key = K(m, "Sha256");
Str *urlKey = K(m, "Sha256");
Args_Add(cli, helpKey, NULL, ARG_OPTIONAL,
Sv(m, "Show this help message."));
Args_Add(cli, noColorKey, NULL, ARG_OPTIONAL,
Sv(m, "Skip ansi color sequences in output."));
Args_Add(cli, sha256Key, NULL, ARG_OPTIONAL,
Sv(m, "Sha256 sum of content to match."));
StrVec *name = StrVec_From(m, S(m, argv[0]));
IoUtil_Annotate(m, name);
Str *fname = IoUtil_FnameStr(m, name);
CliArgs_Parse(cli);
if(CliArgs_Get(cli, noColorKey)){
Ansi_SetColor(FALSE);
}
DebugStack_Pop();
return 0;
}