-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShell.h
More file actions
47 lines (37 loc) · 1009 Bytes
/
Shell.h
File metadata and controls
47 lines (37 loc) · 1009 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
37
38
39
40
41
42
43
44
45
46
47
#ifndef SHELL_H
#define SHELL_H
#include <string>
#include <vector>
#include <deque>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/wait.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cstring>
#include <cstdlib>
#include "Commands.h" // Include your command headers
#include "commandUtils.h" // Include your utility functions
class Shell {
public:
Shell();
~Shell();
void run();
private:
void updatePrompt();
void loadHistory();
void saveHistory();
void historyCommand(std::vector<std::string>& args);
bool handleBuiltInCommands(std::vector<std::string>& args, Shell &shell);
int runCommand(std::vector<std::string> commands);
std::string currentDirectory;
std::string localHome;
std::deque<std::string> commandHistory;
std::string historyFile = "myshell_history.txt";
size_t historyLimit = 20;
size_t historyIndex;
};
#endif // SHELL_H