-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (28 loc) · 713 Bytes
/
Copy pathmain.cpp
File metadata and controls
36 lines (28 loc) · 713 Bytes
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
#include "shell.h"
#include "line_editor.h"
#include <iostream>
#include <string>
void print_version() {
std::cout << "MiniShell " << MINISHELL_VERSION << "\n";
}
void updateTitle() {
std::cout << "\033]0;MiniShell\007";
}
int main(int argc, char* argv[]) {
updateTitle();
// raw terminal mode enable and disable on exit
LineEditor::enableRawMode();
atexit(LineEditor::disableRawMode);
if (argc > 1) {
std::string arg = argv[1];
if (arg == "-v" || arg == "--version") {
print_version();
return 0;
}
std::cerr << "Unknown option: " << arg << "\n";
return 1;
}
Shell shell;
shell.run();
return 0;
}