-
Notifications
You must be signed in to change notification settings - Fork 0
/
ette.cc
37 lines (31 loc) · 896 Bytes
/
ette.cc
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "constants.h"
#include "editor.h"
int main(int argc, char** argv) {
if (argc != 2) {
fprintf(stderr, "Usage: ette <filename>\n");
exit(1);
}
if (std::string(argv[1]) == std::string("--version")) {
printf("ette version %d.%d.%d\n", ::ette::kVersionMajor,
::ette::kVersionMinor, ::ette::kVersionPatch);
exit(0);
}
State* state = new State();
Init(state);
SelectSyntaxHighlight(state, argv[1]);
EnableRawMode(STDIN_FILENO);
HandleEncryption(state, argv[1], {});
Open(state, argv[1]);
SetStatusMessage(state,
"HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
while (1) {
RefreshScreen();
ProcessKeyPress(STDIN_FILENO, state, 0);
}
delete state;
return 0;
}